• V
    sched/fair: Optimize update_blocked_averages() · c622612d
    Vincent Guittot 提交于
    mainline inclusion
    from mainline-5.1-rc2
    commit 31bc6aeaab1d1de8959b67edbed5c7a4b3cdbe7c
    category: bugfix
    bugzilla: 10996
    CVE: NA
    
    ----------------------------------------
    
    Removing a cfs_rq from rq->leaf_cfs_rq_list can break the parent/child
    ordering of the list when it will be added back. In order to remove an
    empty and fully decayed cfs_rq, we must remove its children too, so they
    will be added back in the right order next time.
    
    With a normal decay of PELT, a parent will be empty and fully decayed
    if all children are empty and fully decayed too. In such a case, we just
    have to ensure that the whole branch will be added when a new task is
    enqueued. This is default behavior since :
    
      commit f6783319737f ("sched/fair: Fix insertion in rq->leaf_cfs_rq_list")
    
    In case of throttling, the PELT of throttled cfs_rq will not be updated
    whereas the parent will. This breaks the assumption made above unless we
    remove the children of a cfs_rq that is throttled. Then, they will be
    added back when unthrottled and a sched_entity will be enqueued.
    
    As throttled cfs_rq are now removed from the list, we can remove the
    associated test in update_blocked_averages().
    Signed-off-by: NVincent Guittot <vincent.guittot@linaro.org>
    Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: sargun@sargun.me
    Cc: tj@kernel.org
    Cc: xiexiuqi@huawei.com
    Cc: xiezhipeng1@huawei.com
    Link: https://lkml.kernel.org/r/1549469662-13614-2-git-send-email-vincent.guittot@linaro.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
    Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
    Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    c622612d
fair.c 270.3 KB