]> git.hungrycats.org Git - linux/commitdiff
[PATCH] migration thread fix
authorRobert Love <rml@tech9.net>
Thu, 18 Apr 2002 09:01:31 +0000 (02:01 -0700)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Thu, 18 Apr 2002 09:01:31 +0000 (02:01 -0700)
Attached is a patch that disables interrupts while holding the rq_lock.
This is certainly needed to prevent a race against the timer tick, as
Erich Focht pointed out.

kernel/sched.c

index d9716a3ec8cd65828cb8a0fdd026a431abbca74b..78e60fe666d6b025c16d28e91a788f9334e2dc8a 100644 (file)
@@ -1782,9 +1782,11 @@ repeat:
                cpu_src = p->thread_info->cpu;
                rq_src = cpu_rq(cpu_src);
 
+               local_irq_save(flags);
                double_rq_lock(rq_src, rq_dest);
                if (p->thread_info->cpu != cpu_src) {
                        double_rq_unlock(rq_src, rq_dest);
+                       local_irq_restore(flags);
                        goto repeat;
                }
                if (rq_src == rq) {
@@ -1795,6 +1797,7 @@ repeat:
                        }
                }
                double_rq_unlock(rq_src, rq_dest);
+               local_irq_restore(flags);
 
                up(&req->sem);
        }