• [PATCH -v2 13/18] sched/fair: Propagate an effective runnable_load_

    From Dietmar Eggemann@21:1/5 to Peter Zijlstra on Mon Oct 2 22:50:15 2017
    On 01/09/17 14:21, Peter Zijlstra wrote:
    The load balancer uses runnable_load_avg as load indicator. For
    !cgroup this is:

    runnable_load_avg = \Sum se->avg.load_avg ; where se->on_rq

    That is, a direct sum of all runnable tasks on that runqueue. As
    opposed to load_avg, which is a sum of all tasks on the runqueue,
    which includes a blocked component.

    However, in the cgroup case, this comes apart since the group entities
    are always runnable, even if most of their constituent entities are
    blocked.

    Therefore introduce a runnable_weight which for task entities is the
    same as the regular weight, but for group entities is a fraction of
    the entity weight and represents the runnable part of the group
    runqueue.

    Then propagate this load through the PELT hierarchy to arrive at an
    effective runnable load avgerage -- which we should not confuse with
    the canonical runnable load average.

    Suggested-by: Tejun Heo <tj@kernel.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    ---
    include/linux/sched.h | 3
    kernel/sched/debug.c | 8 ++
    kernel/sched/fair.c | 173 ++++++++++++++++++++++++++++++++------------------
    kernel/sched/sched.h | 3
    4 files changed, 125 insertions(+), 62 deletions(-)

    [...]

    @@ -2931,31 +2949,45 @@ static long calc_cfs_shares(struct cfs_r

    static inline int throttled_hierarchy(struct cfs_rq *cfs_rq);

    -static void update_cfs_shares(struct sched_entity *se)
    +/*
    + * Recomputes the group entity based on the current state of its group
    + * runqueue.
    + */
    +static void update_cfs_group(struct sched_entity *se)

    update_cfs_share(s)() is still mentioned in the function header of update_tg_load_avg() and update_cfs_rq_load_avg().

    Should we rename those comments with this patch?

    IMHO, the comment for update_tg_load_avg() is still true whereas the one
    for update_cfs_rq_load_avg() mentions cfs_rq->avg as
    cfs_rq->avg.load_avg (or cfs_rq_load_avg()) and update_cfs_group()
    doesn't use it anymore. It's now used in calc_group_runnable() and calc_group_shares() instead.

    [...]

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)