|
|
|
@ -5713,13 +5713,18 @@ static void pool_resus(struct pool *pool)
@@ -5713,13 +5713,18 @@ static void pool_resus(struct pool *pool)
|
|
|
|
|
applog(LOG_INFO, "%s alive", pool->poolname); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static struct work *hash_pop(void) |
|
|
|
|
/* If this is called non_blocking, it will return NULL for work so that must
|
|
|
|
|
* be handled. */ |
|
|
|
|
static struct work *hash_pop(bool blocking) |
|
|
|
|
{ |
|
|
|
|
struct work *work = NULL, *tmp; |
|
|
|
|
int hc; |
|
|
|
|
|
|
|
|
|
mutex_lock(stgd_lock); |
|
|
|
|
while (!HASH_COUNT(staged_work)) { |
|
|
|
|
if (!HASH_COUNT(staged_work)) { |
|
|
|
|
if (!blocking) |
|
|
|
|
goto out_unlock; |
|
|
|
|
do { |
|
|
|
|
struct timespec then; |
|
|
|
|
struct timeval now; |
|
|
|
|
int rc; |
|
|
|
@ -5736,6 +5741,7 @@ static struct work *hash_pop(void)
@@ -5736,6 +5741,7 @@ static struct work *hash_pop(void)
|
|
|
|
|
no_work = true; |
|
|
|
|
applog(LOG_WARNING, "Waiting for work to be available from pools."); |
|
|
|
|
} |
|
|
|
|
} while (!HASH_COUNT(staged_work)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (no_work) { |
|
|
|
@ -5764,6 +5770,7 @@ static struct work *hash_pop(void)
@@ -5764,6 +5770,7 @@ static struct work *hash_pop(void)
|
|
|
|
|
|
|
|
|
|
/* Keep track of last getwork grabbed */ |
|
|
|
|
last_getwork = time(NULL); |
|
|
|
|
out_unlock: |
|
|
|
|
mutex_unlock(stgd_lock); |
|
|
|
|
|
|
|
|
|
return work; |
|
|
|
@ -5918,7 +5925,7 @@ struct work *get_work(struct thr_info *thr, const int thr_id)
@@ -5918,7 +5925,7 @@ struct work *get_work(struct thr_info *thr, const int thr_id)
|
|
|
|
|
applog(LOG_DEBUG, "Popping work from get queue to get work"); |
|
|
|
|
diff_t = time(NULL); |
|
|
|
|
while (!work) { |
|
|
|
|
work = hash_pop(); |
|
|
|
|
work = hash_pop(true); |
|
|
|
|
if (stale_work(work, false)) { |
|
|
|
|
discard_work(work); |
|
|
|
|
work = NULL; |
|
|
|
@ -8178,7 +8185,8 @@ begin_bench:
@@ -8178,7 +8185,8 @@ begin_bench:
|
|
|
|
|
/* Keeps slowly generating work even if it's not being
|
|
|
|
|
* used to keep last_getwork incrementing and to see |
|
|
|
|
* if pools are still alive. */ |
|
|
|
|
work = hash_pop(); |
|
|
|
|
work = hash_pop(false); |
|
|
|
|
if (work) |
|
|
|
|
discard_work(work); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|