• Rafael J. Wysocki's avatar
    cpufreq: Add special-purpose fast-switching callback for drivers · ee2cc427
    Rafael J. Wysocki authored
    First off, some cpufreq drivers (eg. intel_pstate) can pass hints
    beyond the current target frequency to the hardware and there are no
    provisions for doing that in the cpufreq framework.  In particular,
    today the driver has to assume that it should not allow the frequency
    to fall below the one requested by the governor (or the required
    capacity may not be provided) which may not be the case and which may
    lead to excessive energy usage in some scenarios.
    
    Second, the hints passed by these drivers to the hardware need not be
    in terms of the frequency, so representing the utilization numbers
    coming from the scheduler as frequency before passing them to those
    drivers is not really useful.
    
    Address the two points above by adding a special-purpose replacement
    for the ->fast_switch callback, called ->adjust_perf, allowing the
    governor to pass abstract performance level (rather than frequency)
    values for the minimum (required) and target (desired) performance
    along with the CPU capacity to compare them to.
    
    Also update the schedutil governor to use the new callback instead
    of ->fast_switch if present and if the utilization mertics are
    frequency-invariant (that is requisite for the direct mapping
    between the utilization and the CPU performance levels to be a
    reasonable approximation).
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
    ee2cc427
cpufreq_schedutil.c 27 KB