Skip to content
Snippets Groups Projects
Commit 67c515e3 authored by William Roper's avatar William Roper
Browse files

reenabling task stealing

parent cc097e53
Branches
No related tags found
No related merge requests found
......@@ -2372,25 +2372,25 @@ struct task *scheduler_gettask(struct scheduler *s, int qid,
if (res != NULL) break;
}
// /* If unsuccessful, try stealing from the other queues. */
// if (s->flags & scheduler_flag_steal) {
// int count = 0, qids[nr_queues];
// for (int k = 0; k < nr_queues; k++)
// if (s->queues[k].count > 0 || s->queues[k].count_incoming > 0) {
// qids[count++] = k;
// }
// for (int k = 0; k < scheduler_maxsteal && count > 0; k++) {
// const int ind = rand_r(&seed) % count;
// TIMER_TIC
// res = queue_gettask(&s->queues[qids[ind]], prev, 0);
// TIMER_TOC(timer_qsteal);
// if (res != NULL)
// break;
// else
// qids[ind] = qids[--count];
// }
// if (res != NULL) break;
// }
/* If unsuccessful, try stealing from the other queues. */
if (s->flags & scheduler_flag_steal) {
int count = 0, qids[nr_queues];
for (int k = 0; k < nr_queues; k++)
if (s->queues[k].count > 0 || s->queues[k].count_incoming > 0) {
qids[count++] = k;
}
for (int k = 0; k < scheduler_maxsteal && count > 0; k++) {
const int ind = rand_r(&seed) % count;
TIMER_TIC
res = queue_gettask(&s->queues[qids[ind]], prev, 0);
TIMER_TOC(timer_qsteal);
if (res != NULL)
break;
else
qids[ind] = qids[--count];
}
if (res != NULL) break;
}
}
/* If we failed, take a short nap. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment