• G
    sched: Enhance the pre/post scheduling logic · 3f029d3c
    Gregory Haskins 提交于
    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: NGregory Haskins <ghaskins@novell.com>
    Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
    LKML-Reference: <20090729150422.17691.55590.stgit@dev.haskins.net>
    Signed-off-by: NIngo Molnar <mingo@elte.hu>
    3f029d3c
sched.c 260.4 KB