![]() | |||||||||||||
Messages in this thread |
Srivatsa Vaddagiri <vatsa@in.ibm.com> wrote: > > On Thu, Feb 19, 2004 at 08:12:19AM +0000, Andrew Morton wrote: > > However, if that wake_up_process() comes too early we'll just flip the new > > thread out of TASK_INTERUPTIBLE into TASK_RUNNING and the schedule() in > > kthread() will fall straight through. So perhaps we can simply remove the > > wait_task_inactive()? > > If wake_up_process() comes too early (when the target task is still > in TASK_RUNNING state), then won't wake_up_process() be a no-op? > In which case, the target kthread will miss a wake-up event > (kthread_start/kthread_stop)? No, that's OK - the new kernel thread sets TASK_INTERRUPTIBLE before waking the invoking thread via complete(): new thread: /* OK, tell user we're spawned, wait for stop or wakeup */ __set_current_state(TASK_INTERRUPTIBLE); complete(&create->started); schedule(); invoker: wait_for_completion(&create->started); create->result = find_task_by_pid(pid); wait_task_inactive(create->result); It's the window after the complete() and before the schedule() where wait_task_inactive() is spinning. - 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-03-22 13:01 [W:0.214 / U:0.140 seconds] ©2003-2008 Jasper Spaans | |||||||||||||