lkml.org 
[lkml]   [2005]   [May]   [31]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateTue, 31 May 2005 15:10:45 +0530
FromSrivatsa Vaddagiri <>
SubjectRe: [PATCH]CPU hotplug breaks wake_up_new_task
On Tue, May 31, 2005 at 07:29:39AM +0000, Shaohua Li wrote:
> Hi,
> There is a race condition at wake_up_new_task at CPU hotplug case.
> Say do_fork
>         copy_process (which sets new forked task's current cpu, cpu_allowed)
>                 <-------- the new forked task's current cpu is offline
>         wake_up_new_task
> wake_up_new_task will put the forked task into a dead cpu.
This was noticed/fixed long back. Apparently somebody has reintroduced
the bug. The simple fix for this race is:


--- kernel/fork.c.org	2005-05-31 14:57:15.000000000 +0530
+++ kernel/fork.c	2005-05-31 15:07:20.000000000 +0530
@@ -1024,8 +1024,7 @@ static task_t *copy_process(unsigned lon
 	 * parent's CPU). This avoids alot of nasty races.
 	 */
 	p->cpus_allowed = current->cpus_allowed;
-	if (unlikely(!cpu_isset(task_cpu(p), p->cpus_allowed)))
-		set_task_cpu(p, smp_processor_id());
+	set_task_cpu(p, smp_processor_id());
 
 	/*
 	 * Check for pending SIGKILL! The new thread should not be allowed
Could you test and check if it avoids whatever problem you are seeing?


-- 


Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-05-31 11:44    [from the cache]
©2003-2008