cpuidle: Reject idle entry if need_resched() is true

There's no reason to enter idle at this point in __CPU_PM_CPU_IDLE_ENTER()
if the CPU needs to reschedule. Instead of fruitlessly entering the
architecture's idle routine, reject the idle entry attempt with an error as
an optimization.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
This commit is contained in:
Sultan Alsawaf 2023-12-02 20:58:01 -08:00 committed by Ksawlii
parent 1b23bb6575
commit 09f69d7d5f

View file

@ -286,7 +286,9 @@ extern s64 cpuidle_governor_latency_req(unsigned int cpu);
({ \
int __ret = 0; \
\
if (!idx) { \
if (need_resched()) { \
__ret = -1; \
} else if (!idx) { \
cpu_do_idle(); \
return idx; \
} \