sched: Enhance the pre/post scheduling logic
authorGregory Haskins <ghaskins@novell.com>
Wed, 29 Jul 2009 15:08:47 +0000 (11:08 -0400)
committerIngo Molnar <mingo@elte.hu>
Sun, 2 Aug 2009 12:26:10 +0000 (14:26 +0200)
commit3f029d3c6d62068d59301d90c18dbde8ee402107
treec9c4e49bc0c8b919a81bf428180b9cffedbef389
parentc3a2ae3d93c0f10d29c071f599764d00b8de00cb
sched: Enhance the pre/post scheduling logic

We currently have an explicit "needs_post" vtable method which
returns a stack variable for whether we should later run
post-schedule.  This leads to an awkward exchange of the
variable as it bubbles back up out of the context switch. Peter
Zijlstra observed that this information could be stored in the
run-queue itself instead of handled on the stack.

Therefore, we revert to the method of having context_switch
return void, and update an internal rq->post_schedule variable
when we require further processing.

In addition, we fix a race condition where we try to access
current->sched_class without holding the rq->lock.  This is
technically racy, as the sched-class could change out from
under us.  Instead, we reference the per-rq post_schedule
variable with the runqueue unlocked, but with preemption
disabled to see if we need to reacquire the rq->lock.

Finally, we clean the code up slightly by removing the #ifdef
CONFIG_SMP conditionals from the schedule() call, and implement
some inline helper functions instead.

This patch passes checkpatch, and rt-migrate.

Signed-off-by: Gregory Haskins <ghaskins@novell.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <20090729150422.17691.55590.stgit@dev.haskins.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/sched.h
kernel/sched.c
kernel/sched_rt.c
This page took 0.025722 seconds and 5 git commands to generate.