• Rafael J. Wysocki's avatar
    cpuidle: teo: Avoid using "early hits" incorrectly · 63f202e5
    Rafael J. Wysocki authored
    If the current state with the maximum "early hits" metric in
    teo_select() is also the one "matching" the expected idle duration,
    it will be used as the candidate one for selection even if its
    "misses" metric is greater than its "hits" metric, which is not
    correct.
    
    In that case, the candidate state should be shallower than the
    current one and its "early hits" metric should be the maximum
    among the idle states shallower than the current one.
    
    To make that happen, modify teo_select() to save the index of
    the state whose "early hits" metric is the maximum for the
    range of states below the current one and go back to that state
    if it turns out that the current one should be rejected.
    
    Fixes: 159e4856 ("cpuidle: teo: Fix "early hits" handling for disabled idle states")
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    63f202e5
teo.c 15 KB