• Vincent Guittot's avatar
    sched: Move CFS tasks to CPUs with higher capacity · 1aaf90a4
    Vincent Guittot authored
    When a CPU is used to handle a lot of IRQs or some RT tasks, the remaining
    capacity for CFS tasks can be significantly reduced. Once we detect such
    situation by comparing cpu_capacity_orig and cpu_capacity, we trig an idle
    load balance to check if it's worth moving its tasks on an idle CPU.
    
    It's worth trying to move the task before the CPU is fully utilized to
    minimize the preemption by irq or RT tasks.
    
    Once the idle load_balance has selected the busiest CPU, it will look for an
    active load balance for only two cases:
    
      - There is only 1 task on the busiest CPU.
    
      - We haven't been able to move a task of the busiest rq.
    
    A CPU with a reduced capacity is included in the 1st case, and it's worth to
    actively migrate its task if the idle CPU has got more available capacity for
    CFS tasks. This test has been added in need_active_balance.
    
    As a sidenote, this will not generate more spurious ilb because we already
    trig an ilb if there is more than 1 busy cpu. If this cpu is the only one that
    has a task, we will trig the ilb once for migrating the task.
    
    The nohz_kick_needed function has been cleaned up a bit while adding the new
    test
    
    env.src_cpu and env.src_rq must be set unconditionnally because they are used
    in need_active_balance which is called even if busiest->nr_running equals 1
    Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Morten.Rasmussen@arm.com
    Cc: dietmar.eggemann@arm.com
    Cc: efault@gmx.de
    Cc: kamalesh@linux.vnet.ibm.com
    Cc: linaro-kernel@lists.linaro.org
    Cc: nicolas.pitre@linaro.org
    Cc: preeti@linux.vnet.ibm.com
    Cc: riel@redhat.com
    Link: http://lkml.kernel.org/r/1425052454-25797-12-git-send-email-vincent.guittot@linaro.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    1aaf90a4
fair.c 216 KB