• Vincent Guittot's avatar
    sched/cpufreq: Rework schedutil governor performance estimation · 9c0b4bb7
    Vincent Guittot authored
    The current method to take into account uclamp hints when estimating the
    target frequency can end in a situation where the selected target
    frequency is finally higher than uclamp hints, whereas there are no real
    needs. Such cases mainly happen because we are currently mixing the
    traditional scheduler utilization signal with the uclamp performance
    hints. By adding these 2 metrics, we loose an important information when
    it comes to select the target frequency, and we have to make some
    assumptions which can't fit all cases.
    
    Rework the interface between the scheduler and schedutil governor in order
    to propagate all information down to the cpufreq governor.
    
    effective_cpu_util() interface changes and now returns the actual
    utilization of the CPU with 2 optional inputs:
    
    - The minimum performance for this CPU; typically the capacity to handle
      the deadline task and the interrupt pressure. But also uclamp_min
      request when available.
    
    - The maximum targeting performance for this CPU which reflects the
      maximum level that we would like to not exceed. By default it will be
      the CPU capacity but can be reduced because of some performance hints
      set with uclamp. The value can be lower than actual utilization and/or
      min performance level.
    
    A new sugov_effective_cpu_perf() interface is also available to compute
    the final performance level that is targeted for the CPU, after applying
    some cpufreq headroom and taking into account all inputs.
    
    With these 2 functions, schedutil is now able to decide when it must go
    above uclamp hints. It now also has a generic way to get the min
    performance level.
    
    The dependency between energy model and cpufreq governor and its headroom
    policy doesn't exist anymore.
    
    eenv_pd_max_util() asks schedutil for the targeted performance after
    applying the impact of the waking task.
    
    [ mingo: Refined the changelog & C comments. ]
    Signed-off-by: default avatarVincent Guittot <vincent.guittot@linaro.org>
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    Acked-by: default avatarRafael J. Wysocki <rafael@kernel.org>
    Link: https://lore.kernel.org/r/20231122133904.446032-2-vincent.guittot@linaro.org
    9c0b4bb7
core.c 307 KB