diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-09-21 22:16:02 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-10-07 13:51:15 +0200 |
commit | 8850cb663b5cda04d33f9cfbc38889d73d3c8e24 (patch) | |
tree | b928705d29ba099d985c9d2090a66ca1d28ed052 /kernel/sched | |
parent | 00619f7c650e4e46c650cb2e2fd5f438b32dc64b (diff) | |
download | linux-8850cb663b5cda04d33f9cfbc38889d73d3c8e24.tar.bz2 |
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
Diffstat (limited to 'kernel/sched')
-rw-r--r-- | kernel/sched/core.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 74db3c3afa6d..3b55ef99c03f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3695,15 +3695,11 @@ void wake_up_if_idle(int cpu) if (!is_idle_task(rcu_dereference(rq->curr))) goto out; - if (set_nr_if_polling(rq->idle)) { - trace_sched_wake_idle_without_ipi(cpu); - } else { - rq_lock_irqsave(rq, &rf); - if (is_idle_task(rq->curr)) - smp_send_reschedule(cpu); - /* Else CPU is not idle, do nothing here: */ - rq_unlock_irqrestore(rq, &rf); - } + rq_lock_irqsave(rq, &rf); + if (is_idle_task(rq->curr)) + resched_curr(rq); + /* Else CPU is not idle, do nothing here: */ + rq_unlock_irqrestore(rq, &rf); out: rcu_read_unlock(); |