Commit a4ec961eccf910dd6d240b4c0a4cf27ed23849b8

Con Kolivas 2011-08-25T10:21:49

We can queue all the necessary work without hitting frequent stales now with the time and string stale protection active all the time. This prevents a pool being falsely labelled as not providing work fast enough.

diff --git a/main.c b/main.c
index 91aff16..17efcdd 100644
--- a/main.c
+++ b/main.c
@@ -2935,19 +2935,11 @@ static bool queue_request(struct thr_info *thr, bool needed)
 {
 	int maxq = opt_queue + mining_threads;
 	struct workio_cmd *wc;
-	int rq, rs;
+	int rq = requests_queued();
 
-	rq = requests_queued();
-	rs = requests_staged();
-
-	/* If we've been generating lots of local work we may already have
-	 * enough in the queue */
-	if (rq >= maxq || rs >= maxq)
+	if (rq >= maxq)
 		return true;
 
-	if (rs > rq)
-		goto out;
-
 	/* fill out work request message */
 	wc = calloc(1, sizeof(*wc));
 	if (unlikely(!wc)) {
@@ -2964,7 +2956,7 @@ static bool queue_request(struct thr_info *thr, bool needed)
 	/* If we're queueing work faster than we can stage it, consider the
 	 * system lagging and allow work to be gathered from another pool if
 	 * possible */
-	if (!rs && rq && needed)
+	if (rq && needed && !requests_staged())
 		wc->lagging = true;
 
 	if (opt_debug)
@@ -2976,7 +2968,7 @@ static bool queue_request(struct thr_info *thr, bool needed)
 		workio_cmd_free(wc);
 		return false;
 	}
-out:
+
 	inc_queued();
 	return true;
 }
@@ -3093,7 +3085,7 @@ retry:
 			ret = true;
 			goto out;
 		}
-		if (requested && requests_queued() > 1 && !pool_tset(pool, &pool->lagging)) {
+		if (requested && !pool_tset(pool, &pool->lagging)) {
 			applog(LOG_WARNING, "Pool %d not providing work fast enough",
 				pool->pool_no);
 			pool->localgen_occasions++;