On Thu, 2010-05-20 at 16:48 -0400, Chris Mason wrote:
Right, so one of the things that I considered was to make p->state an
atomic_t and replace the initial stage of try_to_wake_up() with
something like:
int try_to_wake_up(struct task *p, unsigned int mask, wake_flags)
{
int state = atomic_read(&p->state);
do {
if (!(state & mask))
return 0;
state = atomic_cmpxchg(&p->state, state, TASK_WAKING);
} while (state != TASK_WAKING);
/* do this pending queue + ipi thing */
return 1;
}
Also, I think we might want to put that atomic single linked list thing
into some header (using atomic_long_t or so), because I have a similar
thing living in kernel/perf_event.c, that needs to queue things from NMI
context.
The advantage of doing basically the whole enqueue on the remote cpu is
less cacheline bouncing of the runqueue structures.
--