Commit 8e964073 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Use getticks() to get enough randomness when enqueing tasks without owners.

parent 85568234
...@@ -1381,9 +1381,8 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) { ...@@ -1381,9 +1381,8 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
if (qid >= s->nr_queues) error("Bad computed qid."); if (qid >= s->nr_queues) error("Bad computed qid.");
/* If no previous owner, pick a random queue. */ /* If no previous owner, pick a random queue. */
if (qid < 0) /* Note that getticks() is random enough */
qid = rand_r((unsigned int *)pthread_getspecific(s->local_seed_pointer)) % if (qid < 0) qid = getticks() % s->nr_queues;
s->nr_queues;
/* Increase the waiting counter. */ /* Increase the waiting counter. */
atomic_inc(&s->waiting); atomic_inc(&s->waiting);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment