* [PATCH] CPU stuck in wake_up_forked_thread()
@ 2004-08-20 15:50 Simon Derr
2004-08-21 1:17 ` Nick Piggin
0 siblings, 1 reply; 2+ messages in thread
From: Simon Derr @ 2004-08-20 15:50 UTC (permalink / raw)
To: linux-kernel
Hi,
It seems (as of 2.6.8-rc3) that there is an issue in
wake_up_forked_thread():
from kernel/sched.c:
local_irq_save(flags);
lock_again:
rq = cpu_rq(cpu);
double_rq_lock(this_rq, rq);
BUG_ON(p->state != TASK_RUNNING);
/*
* We did find_idlest_cpu() unlocked, so in theory
* the mask could have changed - just dont migrate
* in this case:
*/
if (unlikely(!cpu_isset(cpu, p->cpus_allowed))) {
cpu = this_cpu;
double_rq_unlock(this_rq, rq);
goto lock_again;
}
But what if 'this_cpu' is not set in p->cpus_allowed ?
Then this CPU might loop here forever.
I someone is interested I have an ugly test program that does trigger
this.
One possible solution could be:
Signed-off-by: Simon Derr <Simon.Derr@bull.net>
Index: kdb_268/kernel/sched.c
===================================================================
--- kdb_268.orig/kernel/sched.c 2004-08-20 16:44:53.033231213 +0200
+++ kdb_268/kernel/sched.c 2004-08-20 17:20:35.439454969 +0200
@@ -1249,7 +1249,11 @@
* in this case:
*/
if (unlikely(!cpu_isset(cpu, p->cpus_allowed))) {
- cpu = this_cpu;
+ if (cpu_isset(this_cpu, p->cpus_allowed))
+ cpu = this_cpu;
+ else
+ cpu = first_cpu(p->cpus_allowed);
+
double_rq_unlock(this_rq, rq);
goto lock_again;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] CPU stuck in wake_up_forked_thread()
2004-08-20 15:50 [PATCH] CPU stuck in wake_up_forked_thread() Simon Derr
@ 2004-08-21 1:17 ` Nick Piggin
0 siblings, 0 replies; 2+ messages in thread
From: Nick Piggin @ 2004-08-21 1:17 UTC (permalink / raw)
To: Simon Derr; +Cc: linux-kernel
Simon Derr wrote:
> Hi,
>
> It seems (as of 2.6.8-rc3) that there is an issue in
> wake_up_forked_thread():
>
Should be fixed in the -mm tree, which should be merged up
soon.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-08-21 1:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-20 15:50 [PATCH] CPU stuck in wake_up_forked_thread() Simon Derr
2004-08-21 1:17 ` Nick Piggin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox