Re: [PATCH] rcu-tasks: Warn on too-short RCU Tasks Rude grace period
From: Joel Fernandes
Date: Sun Oct 18 2026 - 20:02:52 EST
On Sun, Oct 18, 2026 at 02:51:18AM +0000, Zqiang wrote:
> >
> > >
> > > On Oct 15, 2026, at 5:46 AM, Zqiang <qiang.zhang@xxxxxxxxx> wrote:
> > >
> > > The RCU Tasks Rude grace period is implemented by invoking the
> > > schedule_on_each_cpu() with an empty work function, which forces
> > > a context switch on every online CPU and guarantees that all
> > > rude-tasks read-side critical sections have completed. However,
> > > schedule_on_each_cpu() can fail (via alloc_percpu() returning
> > > -ENOMEM) and returns immediately, in which case those context
> > > switches never happen, too-short grace period happen.
> > >
> > > This commit therefore wraps the schedule_on_each_cpu() call in
> > > WARN_ONCE() so that this failure is reported as a "Too-short
> > > grace period" warning.
> > >
> > > Signed-off-by: Zqiang <qiang.zhang@xxxxxxxxx>
> > > ---
> > > kernel/rcu/tasks.h | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> > > index fcac7361ec51..91c25717402e 100644
> > > --- a/kernel/rcu/tasks.h
> > > +++ b/kernel/rcu/tasks.h
> > > @@ -1361,7 +1361,8 @@ static void rcu_tasks_be_rude(struct work_struct *work)
> > > static void rcu_tasks_rude_wait_gp(struct rcu_tasks *rtp)
> > > {
> > > rtp->n_ipis += cpumask_weight(cpu_online_mask);
> > > - schedule_on_each_cpu(rcu_tasks_be_rude);
> > > + WARN_ONCE(schedule_on_each_cpu(rcu_tasks_be_rude),
> > > + "%s: Too-short grace period, OOM is now expected behavior!!!\n", rtp->name);
> > >
> > Is that the best error message? OOM is expected when grace periods do not conclude.
> >
>
> Hi, Joel
>
> I will resend v2, use DEFINE_PER_CPU() to replace alloc_percpu() to allocate work_struct objects.
Thank you! Looking forward to it,
Joel Fernandes