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.