[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210208145308.GC3969@lothringen>
Date: Mon, 8 Feb 2021 15:53:08 +0100
From: Frederic Weisbecker <frederic@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "Paul E . McKenney" <paulmck@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Thomas Gleixner <tglx@...utronix.de>, stable@...r.kernel.org,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH 2/5] rcu/nocb: Perform deferred wake up before last
idle's need_resched() check
On Mon, Feb 08, 2021 at 03:45:50PM +0100, Peter Zijlstra wrote:
> On Mon, Feb 01, 2021 at 12:05:45AM +0100, Frederic Weisbecker wrote:
>
> > diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
> > index 305727ea0677..b601a3aa2152 100644
> > --- a/kernel/sched/idle.c
> > +++ b/kernel/sched/idle.c
> > @@ -55,6 +55,7 @@ __setup("hlt", cpu_idle_nopoll_setup);
> > static noinline int __cpuidle cpu_idle_poll(void)
> > {
> > trace_cpu_idle(0, smp_processor_id());
> > + rcu_nocb_flush_deferred_wakeup();
> > stop_critical_timings();
> > rcu_idle_enter();
> > local_irq_enable();
> > @@ -173,6 +174,8 @@ static void cpuidle_idle_call(void)
> > struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
> > int next_state, entered_state;
> >
> > + rcu_nocb_flush_deferred_wakeup();
> > +
> > /*
> > * Check if the idle task must be rescheduled. If it is the
> > * case, exit the function after re-enabling the local irq.
>
> Ok if I do this instead?
>
> --- a/kernel/sched/idle.c
> +++ b/kernel/sched/idle.c
> @@ -55,7 +55,6 @@ __setup("hlt", cpu_idle_nopoll_setup);
> static noinline int __cpuidle cpu_idle_poll(void)
> {
> trace_cpu_idle(0, smp_processor_id());
> - rcu_nocb_flush_deferred_wakeup();
> stop_critical_timings();
> rcu_idle_enter();
> local_irq_enable();
> @@ -174,8 +173,6 @@ static void cpuidle_idle_call(void)
> struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
> int next_state, entered_state;
>
> - rcu_nocb_flush_deferred_wakeup();
> -
> /*
> * Check if the idle task must be rescheduled. If it is the
> * case, exit the function after re-enabling the local irq.
> @@ -288,6 +285,7 @@ static void do_idle(void)
> }
>
> arch_cpu_idle_enter();
> + rcu_nocb_flush_deferred_wakeup();
>
> /*
> * In poll mode we reenable interrupts and spin. Also if we
Right, I think that should work. Nothing should call_rcu() before the
need_resched() call. And if it does, we still have the nocb_timer to do
the deferred wakeup in the worst case.
Thanks.
Powered by blists - more mailing lists