• V
    sched/fair: Update and fix the runnable propagation rule · a4c3c049
    Vincent Guittot 提交于
    Unlike running, the runnable part can't be directly propagated through
    the hierarchy when we migrate a task. The main reason is that runnable
    time can be shared with other sched_entities that stay on the rq and
    this runnable time will also remain on prev cfs_rq and must not be
    removed.
    
    Instead, we can estimate what should be the new runnable of the prev
    cfs_rq and check that this estimation stay in a possible range. The
    prop_runnable_sum is a good estimation when adding runnable_sum but
    fails most often when we remove it. Instead, we could use the formula
    below instead:
    
      gcfs_rq's runnable_sum = gcfs_rq->avg.load_sum / gcfs_rq->load.weight
    
    which assumes that tasks are equally runnable which is not true but
    easy to compute.
    
    Beside these estimates, we have several simple rules that help us to filter
    out wrong ones:
    
     - ge->avg.runnable_sum <= than LOAD_AVG_MAX
     - ge->avg.runnable_sum >= ge->avg.running_sum (ge->avg.util_sum << LOAD_AVG_MAX)
     - ge->avg.runnable_sum can't increase when we detach a task
    
    The effect of these fixes is better cgroups balancing.
    Signed-off-by: NVincent Guittot <vincent.guittot@linaro.org>
    Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Ben Segall <bsegall@google.com>
    Cc: Chris Mason <clm@fb.com>
    Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
    Cc: Josef Bacik <josef@toxicpanda.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Morten Rasmussen <morten.rasmussen@arm.com>
    Cc: Paul Turner <pjt@google.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Yuyang Du <yuyang.du@intel.com>
    Link: http://lkml.kernel.org/r/1510842112-21028-1-git-send-email-vincent.guittot@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
    a4c3c049
fair.c 260.1 KB