sched: Simplify wake_up_*idle*()

Simplify and make wake_up_if_idle() more robust, also don't iterate
the whole machine with preempt_disable() in it's caller:
wake_up_all_idle_cpus().

This prepares for another wake_up_if_idle() user that needs a full
do_idle() cycle.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Vasily Gorbik <gor@linux.ibm.com>
Tested-by: Vasily Gorbik <gor@linux.ibm.com> # on s390
Link: https://lkml.kernel.org/r/20210929152428.769328779@infradead.org
This commit is contained in:
Peter Zijlstra
2021-09-21 22:16:02 +02:00
parent 00619f7c65
commit 8850cb663b
2 changed files with 8 additions and 12 deletions

View File

@@ -1170,14 +1170,14 @@ void wake_up_all_idle_cpus(void)
{
int cpu;
preempt_disable();
cpus_read_lock();
for_each_online_cpu(cpu) {
if (cpu == smp_processor_id())
if (cpu == raw_smp_processor_id())
continue;
wake_up_if_idle(cpu);
}
preempt_enable();
cpus_read_unlock();
}
EXPORT_SYMBOL_GPL(wake_up_all_idle_cpus);