diff options
author | Richard Braun <rbraun@sceen.net> | 2013-05-15 20:39:15 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-05-15 20:39:15 +0200 |
commit | 564fd3aefe3fcb27de4c8fc375fc10293a002fa9 (patch) | |
tree | ec7fea8fab38be69487e244debbfc559d4559149 | |
parent | 6db2ed31f9aaae4b54f10468dfa3d7c4ee0cba3d (diff) |
kern/thread: add comment about balancer threads
Balancer threads use their own version of thread_sleep because they have to
keep the run queue locked after pulling threads, otherwise remote balancers
might pull threads from a run queue right before a scheduling decision is
made, possibly putting the run queue in a state where only expired threads
remain.
Although this might be relaxed in the future, this is how it's currently
done, and a clear note in the main balancer function definitely helps against
breaking that part.
-rw-r--r-- | kern/thread.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kern/thread.c b/kern/thread.c index 1b9ab6f3..b01a3a50 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -1574,7 +1574,8 @@ thread_balance(void *arg) /* * This function may temporarily enable preemption and release the - * run queue lock. + * run queue lock, but on return, the lock must remain held until this + * balancer thread sleeps. */ thread_sched_ts_balance(runq, &flags); } |