• Valentin Schneider's avatar
    sched/fair: Clean up definition of NOHZ blocked load functions · b0c79224
    Valentin Schneider authored
    cfs_rq_has_blocked() and others_have_blocked() are only used within
    update_blocked_averages(). The !CONFIG_FAIR_GROUP_SCHED version of the
    latter calls them within a #define CONFIG_NO_HZ_COMMON block, whereas
    the CONFIG_FAIR_GROUP_SCHED one calls them unconditionnally.
    
    As reported by Qian, the above leads to this warning in
    !CONFIG_NO_HZ_COMMON configs:
    
      kernel/sched/fair.c: In function 'update_blocked_averages':
      kernel/sched/fair.c:7750:7: warning: variable 'done' set but not used [-Wunused-but-set-variable]
    
    It wouldn't be wrong to keep cfs_rq_has_blocked() and
    others_have_blocked() as they are, but since their only current use is
    to figure out when we can stop calling update_blocked_averages() on
    fully decayed NOHZ idle CPUs, we can give them a new definition for
    !CONFIG_NO_HZ_COMMON.
    
    Change the definition of cfs_rq_has_blocked() and
    others_have_blocked() for !CONFIG_NO_HZ_COMMON so that the
    NOHZ-specific blocks of update_blocked_averages() become no-ops and
    the 'done' variable gets optimised out.
    
    While at it, remove the CONFIG_NO_HZ_COMMON block from the
    !CONFIG_FAIR_GROUP_SCHED definition of update_blocked_averages() by
    using the newly-introduced update_blocked_load_status() helper.
    
    No change in functionality intended.
    
    [ Additions by Peter Zijlstra. ]
    Reported-by: default avatarQian Cai <cai@lca.pw>
    Signed-off-by: default avatarValentin Schneider <valentin.schneider@arm.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lkml.kernel.org/r/20190603115424.7951-1-valentin.schneider@arm.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    b0c79224
fair.c 275 KB