Browse Source

Consider extra longpoll work items as staged_extra so as to make sure we queue more work if queueing regular work items as longpolls.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
50a33aa6a3
  1. 16
      cgminer.c

16
cgminer.c

@ -216,7 +216,7 @@ struct thread_q *getq;
static int total_work; static int total_work;
struct work *staged_work = NULL; struct work *staged_work = NULL;
static int staged_clones; static int staged_extras;
struct schedtime { struct schedtime {
bool enable; bool enable;
@ -2062,8 +2062,8 @@ static int discard_stale(void)
HASH_ITER(hh, staged_work, work, tmp) { HASH_ITER(hh, staged_work, work, tmp) {
if (stale_work(work, false)) { if (stale_work(work, false)) {
HASH_DEL(staged_work, work); HASH_DEL(staged_work, work);
if (work->clone) if (work->clone || work->longpoll)
--staged_clones; --staged_extras;
discard_work(work); discard_work(work);
stale++; stale++;
} }
@ -2205,8 +2205,8 @@ static bool hash_push(struct work *work)
if (likely(!getq->frozen)) { if (likely(!getq->frozen)) {
HASH_ADD_INT(staged_work, id, work); HASH_ADD_INT(staged_work, id, work);
HASH_SORT(staged_work, tv_sort); HASH_SORT(staged_work, tv_sort);
if (work->clone) if (work->clone || work->longpoll)
++staged_clones; ++staged_extras;
} else } else
rc = false; rc = false;
pthread_cond_signal(&getq->cond); pthread_cond_signal(&getq->cond);
@ -3121,7 +3121,7 @@ static bool queue_request(struct thr_info *thr, bool needed)
/* Space out retrieval of extra work according to the number of mining /* Space out retrieval of extra work according to the number of mining
* threads */ * threads */
if (rq >= mining_threads + staged_clones && if (rq >= mining_threads + staged_extras &&
(now.tv_sec - requested_tv_sec) < opt_scantime / (mining_threads + 1)) (now.tv_sec - requested_tv_sec) < opt_scantime / (mining_threads + 1))
return true; return true;
@ -3170,8 +3170,8 @@ static struct work *hash_pop(const struct timespec *abstime)
if (HASH_COUNT(staged_work)) { if (HASH_COUNT(staged_work)) {
work = staged_work; work = staged_work;
HASH_DEL(staged_work, work); HASH_DEL(staged_work, work);
if (work->clone) if (work->clone || work->longpoll)
--staged_clones; --staged_extras;
} }
mutex_unlock(stgd_lock); mutex_unlock(stgd_lock);

Loading…
Cancel
Save