Skip to content
  • Dietmar Eggemann's avatar
    sched: Make load tracking frequency scale-invariant · 51318de5
    Dietmar Eggemann authored and Morten Rasmussen's avatar Morten Rasmussen committed
    
    
    Apply frequency scale-invariance correction factor to load tracking.
    Each segment of the sched_avg::runnable_avg_sum geometric series is now
    scaled by the current frequency so the sched_avg::load_avg_contrib of each
    entity will be invariant with frequency scaling. As a result,
    cfs_rq::runnable_load_avg which is the sum of sched_avg::load_avg_contrib,
    becomes invariant too. So the load level that is returned by
    weighted_cpuload, stays relative to the max frequency of the cpu.
    
    Then, we want the keep the load tracking values in a 32bits type, which
    implies that the max value of sched_avg::{runnable|running}_avg_sum must
    be lower than 2^32/88761=48388 (88761 is the max weight of a task). As
    LOAD_AVG_MAX = 47742, arch_scale_freq_capacity must return a value less
    than (48388/47742) << SCHED_CAPACITY_SHIFT = 1037 (SCHED_SCALE_CAPACITY =
    1024). So we define the range to [0..SCHED_SCALE_CAPACITY] in order to
    avoid overflow.
    
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
    Acked-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
    51318de5