Skip to content
  • vingu-linaro's avatar
    sched: make scale_rt invariant with frequency · e25ec760
    vingu-linaro authored and Morten Rasmussen's avatar Morten Rasmussen committed
    
    
    The average running time of RT tasks is used to estimate the remaining compute
    capacity for CFS tasks. This remaining capacity is the original capacity scaled
    down by a factor (aka scale_rt_capacity). This estimation of available capacity
    must also be invariant with frequency scaling.
    
    A frequency scaling factor is applied on the running time of the RT tasks for
    computing scale_rt_capacity.
    
    In sched_rt_avg_update, we scale the RT execution time like below:
    rq->rt_avg += rt_delta * arch_scale_freq_capacity() >> SCHED_CAPACITY_SHIFT
    
    Then, scale_rt_capacity can be summarized by:
    scale_rt_capacity = SCHED_CAPACITY_SCALE -
    		((rq->rt_avg << SCHED_CAPACITY_SHIFT) / period)
    
    We can optimize by removing right and left shift in the computation of rq->rt_avg
    and scale_rt_capacity
    
    The call to arch_scale_frequency_capacity in the rt scheduling path might be
    a concern for RT folks because I'm not sure whether we can rely on
    arch_scale_freq_capacity to be short and efficient ?
    
    Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
    Acked-by: default avatarMorten Rasmussen <morten.rasmussen@arm.com>
    e25ec760