diff options
author | Richard Braun <rbraun@sceen.net> | 2013-03-12 21:06:46 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-03-12 21:06:46 +0100 |
commit | fd051e1e8b2cae9a302c08ff6df76b98ea6fe58e (patch) | |
tree | 9694d8980fed6adb94866c49583074c7a1f07a1e | |
parent | 4b402df37320dd649bb2178c5012e155025a0848 (diff) |
kern/thread: fix balancer initialization and wakeup
-rw-r--r-- | kern/thread.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kern/thread.c b/kern/thread.c index 3acfa07d..03a41d70 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -743,6 +743,9 @@ thread_sched_ts_wakeup_balancer(struct thread_runq *runq) { unsigned long on_rq; + if (runq->balancer == NULL) + return; + on_rq = atomic_cas(&runq->balancer->on_rq, 0, 1); if (on_rq) @@ -1376,8 +1379,12 @@ thread_balancer(void *arg) runq = arg; for (;;) { - thread_sleep(); + /* + * Start by balancing in case the first threads were not evenly + * dispatched. + */ thread_sched_ts_balance(runq); + thread_sleep(); } } |