From: "Zqiang" <qiang.zhang@linux.dev>
To: paulmck@kernel.org, "Bradley Morgan" <brads@mainlining.org>
Cc: frederic@kernel.org, neeraj.upadhyay@kernel.org,
joelagnelf@nvidia.com, josh@joshtriplett.org, boqun@kernel.org,
urezki@gmail.com, rostedt@goodmis.org,
mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com,
rcu@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rcu/tasks: Use static per cpu work_struct for Tasks Rude grace periods
Date: Sun, 18 Oct 2026 02:48:46 +0000 [thread overview]
Message-ID: <0d94c4f119546b07d10fa5edac08b89ca8b9c04a@linux.dev> (raw)
In-Reply-To: <4b456047-62ae-4bc2-8da5-e4e5e603fcbb@paulmck-laptop>
>
> On Sat, Oct 17, 2026 at 12:33:13PM +0000, Bradley Morgan wrote:
>
> >
> > Zqiang caught a snafu in the rude grace period, if a too small grace
> > period was reached, a UAF could occur. However, his patch used
> > a WARN_ONCE() on schedule_on_each_cpu() OOM failures, which would not
> > have handled the failure properly.
> >
> > Instead of throwing a warning or relying on dynamic alloc_percpu(), replace
> > the dynamic allocation with static per cpu work_struct instances. Using
> > schedule_work_on() and flush_work() keeps everything in task context,
> > guarantees the required context switch on every online CPU, and stays
> > zero allocation so it cannot fail under OOM.
> >
> > Suggested-by: Zqiang <qiang.zhang@linux.dev>
> > Signed-off-by: Bradley Morgan <brads@mainlining.org>
> >
> Sorry, Bradley, but no, absolutely not.
>
> Because this not taking a suggestion, but is instead *exactly* Zqiang's
> patch. We do not commit plagiarism in the Linux-kernel community.
>
> Zqiang, please submit a proper patch with appropriate credit to Bradley.
> The obvious approach would be to following his example, that is, to
> credit him using Suggested-by, but Reported-by or a sentence calling out
> his feedback in the commit log would suffice. However, I will defer to
> your best judgment.
Thanks, Paul
I will resend it as v2 and add Bradley as Suggested-by.
Thanks
Zqiang
>
> Thanx, Paul
>
> >
> > ---
> > kernel/rcu/tasks.h | 16 +++++++++++++++-
> > 1 file changed, 15 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> > index 627295396cd9..f81c0ea0b92a 100644
> > --- a/kernel/rcu/tasks.h
> > +++ b/kernel/rcu/tasks.h
> > @@ -1348,11 +1348,25 @@ static void rcu_tasks_be_rude(struct work_struct *work)
> > {
> > }
> >
> > +static DEFINE_PER_CPU(struct work_struct, tasks_rude_work);
> > +
> > // Wait for one rude RCU-tasks grace period.
> > static void rcu_tasks_rude_wait_gp(struct rcu_tasks *rtp)
> > {
> > + int cpu;
> > +
> > + guard(cpus_read_lock)();
> > rtp->n_ipis += cpumask_weight(cpu_online_mask);
> > - schedule_on_each_cpu(rcu_tasks_be_rude);
> > +
> > + for_each_online_cpu(cpu) {
> > + struct work_struct *work = &per_cpu(tasks_rude_work, cpu);
> > +
> > + INIT_WORK(work, rcu_tasks_be_rude);
> > + schedule_work_on(cpu, work);
> > + }
> > +
> > + for_each_online_cpu(cpu)
> > + flush_work(&per_cpu(tasks_rude_work, cpu));
> > }
> >
> > static void call_rcu_tasks_rude(struct rcu_head *rhp, rcu_callback_t func);
> > --
> > 2.53.0
> >
>
prev parent reply other threads:[~2026-10-18 2:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-17 12:33 Bradley Morgan
2026-10-17 17:55 ` Paul E. McKenney
2026-10-17 18:00 ` Bradley Morgan
2026-10-18 2:48 ` Zqiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0d94c4f119546b07d10fa5edac08b89ca8b9c04a@linux.dev \
--to=qiang.zhang@linux.dev \
--cc=boqun@kernel.org \
--cc=brads@mainlining.org \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=joelagnelf@nvidia.com \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=neeraj.upadhyay@kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=urezki@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®