cpuidle: menu: Fall back to polling if next timer event is near
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 20 Mar 2016 00:33:35 +0000 (01:33 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 21 Mar 2016 14:50:28 +0000 (15:50 +0100)
commit0c313cb207326f759a58f486214288411b25d4cf
tree57ae8bbc8c73539174eb6f026e8592d9d31893df
parente132b9b3bc7f19e9b158e42b323881d5dee5ecf3
cpuidle: menu: Fall back to polling if next timer event is near

Commit a9ceb78bc75c (cpuidle,menu: use interactivity_req to disable
polling) changed the behavior of the fallback state selection part
of menu_select() so it looks at interactivity_req instead of
data->next_timer_us when it makes its decision.  That effectively
caused polling to be used more often as fallback idle which led to
significant increases of energy consumption in some cases.

Commit e132b9b3bc7f (cpuidle: menu: use high confidence factors
only when considering polling) changed that logic again to be more
predictable, but that didn't help with the increased energy
consumption problem.

For this reason, go back to making decisions on which state to fall
back to based on data->next_timer_us which is the time we know for
sure something will happen rather than a prediction (which may be
inaccurate and turns out to be so often enough to be problematic).
However, take the target residency of the first proper idle state
(C1) into account, so that state is not used as the fallback one
if its target residency is greater than data->next_timer_us.

Fixes: a9ceb78bc75c (cpuidle,menu: use interactivity_req to disable polling)
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reported-and-tested-by: Doug Smythies <dsmythies@telus.net>
drivers/cpuidle/governors/menu.c