Re: keventd_create_kthread
From: Ingo Molnar
Date: Thu Feb 19 2004 - 02:49:40 EST
On Thu, 19 Feb 2004, Rusty Russell wrote:
> That's not enough: it can set that and then get preemted. It really
> want to return when the task is off the runqueue. The original
> wait_task_inactive() does an incredible complicated and AFAICT useless
> dance wrt not locking and disabling preempt explicitly. Ingo, how's
> this replacement? (And who wrote this code?)
this is old code that morphed many times. Its main use was for exit.c's
purpose and in heavy clone/exit workloads it made quite a difference
whether the 'polling' for task exit was done under the runqueue lock or
not - hence the complexity. Task freeing is poll-free in 2.6 so
wait_task_inactive() doesnt get nearly as heavy use.
The current wait_task_inactive() code seems to be OK on x86.
Context-switching cannot be preempted. The goal of wait_task_inactive() is
to wait for the task to unschedule on a CPU. If that's due to preempt then
it's due to preempt.
i'd strongly advise against using wait_task_inactive() in
keventd_create_kthread() - it's _polling_. We must not do any polling like
that in any modern interface. Why does keventd_create_kthread() need
wait_task_inactive()?
Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/