]> git.baikalelectronics.ru Git - kernel.git/commit
cpuidle: poll_state: Revise loop termination condition
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 2 Oct 2018 21:50:30 +0000 (23:50 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 4 Oct 2018 17:27:27 +0000 (19:27 +0200)
commit3e14da156c866c0f947011fa1977adb745f175e5
treeff58e0d232ffb434426a29d50f066f17554ee6c7
parent564253efa6ad66aa183cfdfb8608f912fb0c1dc3
cpuidle: poll_state: Revise loop termination condition

If need_resched() returns "false", breaking out of the loop in
poll_idle() will cause a new idle state to be selected, so in fact
it usually doesn't make sense to spin in it longer than the target
residency of the second state.  [Note that the "polling" state is
used only if there is at least one "real" state defined in addition
to it, so the second state is always there.]  On the other hand,
breaking out of it early (say in case the next state is disabled)
shouldn't hurt as it is polling anyway.

For this reason, make the loop in poll_idle() break if the CPU has
been spinning longer than the target residency of the second state
(the "polling" state can only be state[0]).

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/poll_state.c