OSDN Git Service

cpuidle: Optimize pm_qos notifier callback
authorSultan Alsawaf <sultan@kerneltoast.com>
Sun, 26 May 2019 17:18:46 +0000 (10:18 -0700)
committer0ranko0P <ranko0p@outlook.com>
Sat, 7 Dec 2019 10:01:16 +0000 (18:01 +0800)
commit420f0a5483c030c58d0a91f49976c20c9bd95911
treeca51a7625f373ac70d79662d5ef9e9f3482865dc
parent839ade8d690354deabad3a0c54e6793900979c05
cpuidle: Optimize pm_qos notifier callback

The pm_qos notifier currently suffers from a number of pitfalls: it
sends IPIs to CPUs that may not be idle, waits for the IPIs to finish
propagating while preemption is disabled (resulting in a long busy wait
for the pm_qos_update_target caller), needlessly calls a no-op
function when the IPIs are processed, and sends IPIs even when the CPU
latency requirement is relaxed.

Optimize the pm_qos notifier by using arch_send_call_function_ipi_mask
instead of smp_call_function_many to eliminate the need to call a no-op
function (with the added benefit of it not blocking) and only sending
IPIs to CPUs that are idle. Additionally, only send IPIs when the CPU
latency requirement is tightened, since it's not necessary to kick CPUs
out of idle when the latency requirement is relaxed.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
drivers/cpuidle/cpuidle.c