]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] fix busy loop in migration thread init
authorAnton Blanchard <anton@samba.org>
Mon, 8 Apr 2002 04:30:51 +0000 (21:30 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Mon, 8 Apr 2002 04:30:51 +0000 (21:30 -0700)
Since we do not set the task state to TASK_INTERRUPTIBLE, we busy loop.

On larger SMP this can actually result in a lockup due to the way
migration thread initalisation is done (nr_cpus threads are created
and they all busy loop until the scheduler evenly distributes them,
one on each cpu. With this rogue thread busy looping things can become
unbalanced and the migration threads never distribute themselves onto
all cpus).

kernel/sched.c

index e746d65c7efaa3c7422770c22ac907be4389e1a5..d1df13d565e22a6d99ebfcad14f01da73f301f4e 100644 (file)
@@ -1689,8 +1689,10 @@ void __init migration_init(void)
        for (cpu = 0; cpu < smp_num_cpus; cpu++) {
                int logical = cpu_logical_map(cpu);
 
-               while (!cpu_rq(logical)->migration_thread)
+               while (!cpu_rq(logical)->migration_thread) {
+                       set_current_state(TASK_INTERRUPTIBLE);
                        schedule_timeout(2);
+               }
        }
        if (migration_mask)
                BUG();