• Rafael J. Wysocki's avatar
    cpuidle: teo: Consider hits and misses metrics of disabled states · e43dcf20
    Rafael J. Wysocki authored
    The TEO governor uses idle duration "bins" defined in accordance with
    the CPU idle states table provided by the driver, so that each "bin"
    covers the idle duration range between the target residency of the
    idle state corresponding to it and the target residency of the closest
    deeper idle state.  The governor collects statistics for each bin
    regardless of whether or not the idle state corresponding to it is
    currently enabled.
    
    In particular, the "hits" and "misses" metrics measure the likelihood
    of a situation in which both the time till the next timer (sleep
    length) and the idle duration measured after wakeup fall into the
    given bin.  Namely, if the "hits" value is greater than the "misses"
    one, that situation is more likely than the one in which the sleep
    length falls into the given bin, but the idle duration measured after
    wakeup falls into a bin corresponding to one of the shallower idle
    states.
    
    If the idle state corresponding to the given bin is disabled, it
    cannot be selected and if it turns out to be the one that should be
    selected, a shallower idle state needs to be used instead of it.
    Nevertheless, the metrics collected for the bin corresponding to it
    are still valid and need to be taken into account as though that
    state had not been disabled.
    
    For this reason, make teo_select() always use the "hits" and "misses"
    values of the idle duration range that the sleep length falls into
    even if the specific idle state corresponding to it is disabled and
    if the "hits" values is greater than the "misses" one, select the
    closest enabled shallower idle state in that case.
    
    Fixes: b26bf6ab ("cpuidle: New timer events oriented governor for tickless systems")
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: 5.1+ <stable@vger.kernel.org> # 5.1+
    e43dcf20
teo.c 14.2 KB