cpuidle: teo: Allow tick to be stopped if PM QoS is used
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 19 Jul 2019 10:12:42 +0000 (12:12 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 5 Aug 2019 09:02:44 +0000 (11:02 +0200)
commitcab09f3d2d2a0a6cb3dfb678660d67a2c3764f50
tree36ee7c7461b5c4d502248ebe7820417a752bd3a1
parent32b91ca15353b2803d27cfc747156e72dd2cd5d8
cpuidle: teo: Allow tick to be stopped if PM QoS is used

The TEO goveror prevents the scheduler tick from being stopped (unless
stopped already) if there is a PM QoS latency constraint for the given
CPU and the target residency of the deepest idle state matching that
constraint is below the tick boundary.

However, that is problematic if CPUs with PM QoS latency constraints
are idle for long times, because it effectively causes the tick to
run on them all the time which is wasteful.  [It is also confusing
and questionable if they are full dynticks CPUs.]

To address that issue, modify the TEO governor to carry out the
entire search for the most suitable idle state (from the target
residency perspective) even if a latency constraint is present,
to allow it to determine the expected idle duration in all cases.

Also, when using the last several measured idle duration values
to refine the idle state selection, make it compare those values
with the current expected idle duration value (instead of
comparing them with the target residency of the idle state
selected so far) which should prevent the tick from being
retained when it makes sense to stop it sometimes (especially
in the presence of PM QoS latency constraints).

Fixes: b26bf6ab716f ("cpuidle: New timer events oriented governor for tickless systems")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/governors/teo.c