• Viresh Kumar's avatar
    sched/fair: Fall back to sched-idle CPU if idle CPU isn't found · 3c29e651
    Viresh Kumar authored
    We try to find an idle CPU to run the next task, but in case we don't
    find an idle CPU it is better to pick a CPU which will run the task the
    soonest, for performance reason.
    
    A CPU which isn't idle but has only SCHED_IDLE activity queued on it
    should be a good target based on this criteria as any normal fair task
    will most likely preempt the currently running SCHED_IDLE task
    immediately. In fact, choosing a SCHED_IDLE CPU over a fully idle one
    shall give better results as it should be able to run the task sooner
    than an idle CPU (which requires to be woken up from an idle state).
    
    This patch updates both fast and slow paths with this optimization.
    Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vincent Guittot <vincent.guittot@linaro.org>
    Cc: chris.redpath@arm.com
    Cc: quentin.perret@linaro.org
    Cc: songliubraving@fb.com
    Cc: steven.sistare@oracle.com
    Cc: subhra.mazumdar@oracle.com
    Cc: tkjos@google.com
    Link: https://lkml.kernel.org/r/eeafa25fdeb6f6edd5b2da716bc8f0ba7708cbcf.1561523542.git.viresh.kumar@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    3c29e651
fair.c 281 KB