OSDN Git Service
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>