Browse Source

titan: Do not fill up next slot immediately after urgent setwork

(that saves us a couple of milliseconds :)
Vitalii Demianets 11 years ago
parent
commit
028cf30ceb
1 changed files with 7 additions and 0 deletions
  1. 7 0
      driver-titan.c

+ 7 - 0
driver-titan.c

@@ -457,6 +457,7 @@ static void knc_titan_poll(struct thr_info * const thr)
 			}
 			}
 			if ((!work_accepted) || (NULL == knccore))
 			if ((!work_accepted) || (NULL == knccore))
 				break;
 				break;
+			bool was_flushed = false;
 			if (knc->need_flush[asic] || need_replace) {
 			if (knc->need_flush[asic] || need_replace) {
 				struct work *work1, *tmp1;
 				struct work *work1, *tmp1;
 				applog(LOG_NOTICE, "%s: Flushing stale works (%s)", knccore->proc->dev_repr,
 				applog(LOG_NOTICE, "%s: Flushing stale works (%s)", knccore->proc->dev_repr,
@@ -470,6 +471,7 @@ static void knc_titan_poll(struct thr_info * const thr)
 					}
 					}
 				}
 				}
 				delay_usecs = 0;
 				delay_usecs = 0;
+				was_flushed = true;
 			}
 			}
 			--knc->workqueue_size;
 			--knc->workqueue_size;
 			DL_DELETE(knc->workqueue, work);
 			DL_DELETE(knc->workqueue, work);
@@ -478,6 +480,11 @@ static void knc_titan_poll(struct thr_info * const thr)
 			if (++(knc->next_slot[asic]) > KNC_TITAN_MAX_WORK_SLOT_NUM)
 			if (++(knc->next_slot[asic]) > KNC_TITAN_MAX_WORK_SLOT_NUM)
 				knc->next_slot[asic] = KNC_TITAN_MIN_WORK_SLOT_NUM;
 				knc->next_slot[asic] = KNC_TITAN_MIN_WORK_SLOT_NUM;
 			++workaccept;
 			++workaccept;
+			/* If we know for sure that this work was urgent, then we don't need to hurry up
+			 * with filling next slot, we have plenty of time until current work completes.
+			 * So, better to proceed with other ASICs. */
+			if (was_flushed)
+				break;
 		}
 		}
 	}
 	}