mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 13:51:52 +00:00
idle / sleep: Avoid excessive disabling and enabling interrupts
Disabling interrupts at the end of cpuidle_enter_freeze() is not useful, because its caller, cpuidle_idle_call(), re-enables them right away after invoking it. To avoid that unnecessary back and forth dance with interrupts, make cpuidle_enter_freeze() enable interrupts after calling enter_freeze_proper() and drop the local_irq_disable() at its end, so that all of the code paths in it end up with interrupts enabled. Then, cpuidle_idle_call() will not need to re-enable interrupts after calling cpuidle_enter_freeze() any more, because the latter will return with interrupts enabled, in analogy with cpuidle_enter(). Reported-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
This commit is contained in:
parent
c517d838eb
commit
01e04f466e
2 changed files with 3 additions and 4 deletions
|
@ -117,6 +117,8 @@ static void enter_freeze_proper(struct cpuidle_driver *drv,
|
||||||
* If there are states with the ->enter_freeze callback, find the deepest of
|
* If there are states with the ->enter_freeze callback, find the deepest of
|
||||||
* them and enter it with frozen tick. Otherwise, find the deepest state
|
* them and enter it with frozen tick. Otherwise, find the deepest state
|
||||||
* available and enter it normally.
|
* available and enter it normally.
|
||||||
|
*
|
||||||
|
* Returns with enabled interrupts.
|
||||||
*/
|
*/
|
||||||
void cpuidle_enter_freeze(void)
|
void cpuidle_enter_freeze(void)
|
||||||
{
|
{
|
||||||
|
@ -132,6 +134,7 @@ void cpuidle_enter_freeze(void)
|
||||||
index = cpuidle_find_deepest_state(drv, dev, true);
|
index = cpuidle_find_deepest_state(drv, dev, true);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
enter_freeze_proper(drv, dev, index);
|
enter_freeze_proper(drv, dev, index);
|
||||||
|
local_irq_enable();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,9 +147,6 @@ void cpuidle_enter_freeze(void)
|
||||||
cpuidle_enter(drv, dev, index);
|
cpuidle_enter(drv, dev, index);
|
||||||
else
|
else
|
||||||
arch_cpu_idle();
|
arch_cpu_idle();
|
||||||
|
|
||||||
/* Interrupts are enabled again here. */
|
|
||||||
local_irq_disable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -116,7 +116,6 @@ static void cpuidle_idle_call(void)
|
||||||
*/
|
*/
|
||||||
if (idle_should_freeze()) {
|
if (idle_should_freeze()) {
|
||||||
cpuidle_enter_freeze();
|
cpuidle_enter_freeze();
|
||||||
local_irq_enable();
|
|
||||||
goto exit_idle;
|
goto exit_idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue