[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YW6LgO4OK+YPy90S@hirez.programming.kicks-ass.net>
Date: Tue, 19 Oct 2021 11:10:24 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Qian Cai <quic_qiancai@...cinc.com>
Cc: gor@...ux.ibm.com, jpoimboe@...hat.com, jikos@...nel.org,
mbenes@...e.cz, pmladek@...e.com, mingo@...nel.org,
linux-kernel@...r.kernel.org, joe.lawrence@...hat.com,
fweisbec@...il.com, tglx@...utronix.de, hca@...ux.ibm.com,
svens@...ux.ibm.com, sumanthk@...ux.ibm.com,
live-patching@...r.kernel.org, paulmck@...nel.org,
rostedt@...dmis.org, x86@...nel.org
Subject: Re: [PATCH v2 04/11] sched: Simplify wake_up_*idle*()
On Tue, Oct 19, 2021 at 10:56:48AM +0200, Peter Zijlstra wrote:
> On Mon, Oct 18, 2021 at 11:47:32PM -0400, Qian Cai wrote:
> > Peter, any thoughts? I did confirm that reverting the commit fixed the issue.
> >
> > On 10/13/2021 10:32 AM, Qian Cai wrote:
> > >
> > >
> > > On 9/29/2021 11:17 AM, Peter Zijlstra wrote:
> > >> --- a/kernel/smp.c
> > >> +++ b/kernel/smp.c
> > >> @@ -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();
>
> Right, so yesterday I thought: YW2KGrvvv/vSA+97@...ez.programming.kicks-ass.net
> but today I might have another idea, lemme go prod at this a bit more.
Here, hows this then?
---
diff --git a/kernel/smp.c b/kernel/smp.c
index ad0b68a3a3d3..61ddc7a3bafa 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -1170,14 +1170,12 @@ void wake_up_all_idle_cpus(void)
{
int cpu;
- cpus_read_lock();
- for_each_online_cpu(cpu) {
- if (cpu == raw_smp_processor_id())
- continue;
-
- wake_up_if_idle(cpu);
+ for_each_cpu(cpu) {
+ preempt_disable();
+ if (cpu != smp_processor_id() && cpu_online(cpu))
+ wake_up_if_idle(cpu);
+ preempt_enable();
}
- cpus_read_unlock();
}
EXPORT_SYMBOL_GPL(wake_up_all_idle_cpus);
Powered by blists - more mailing lists