* [PATCH] rcu-tasks: Remove unnecessary smp_store operations in the cblist_init_generic()
@ 2025-12-14 2:49 Zqiang
2025-12-25 18:57 ` Paul E. McKenney
0 siblings, 1 reply; 3+ messages in thread
From: Zqiang @ 2025-12-14 2:49 UTC (permalink / raw)
To: paulmck, frederic, neeraj.upadhyay, joelagnelf
Cc: rcu, linux-kernel, qiang.zhang
The cblist_init_generic() is executed during the CPU early boot
phase due to commit:30ef09635b9e ("rcu-tasks: Initialize callback
lists at rcu_init() time"), at this time, only one boot CPU is
online. this commit therefore use WRITE_ONCE() to replace the
smp_store_release() to assigning rtp->percpu_enqueue_lim in the
cblist_init_generic().
Signed-off-by: Zqiang <qiang.zhang@linux.dev>
---
kernel/rcu/tasks.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
index 76f952196a29..f763f60d5e50 100644
--- a/kernel/rcu/tasks.h
+++ b/kernel/rcu/tasks.h
@@ -292,7 +292,7 @@ static void cblist_init_generic(struct rcu_tasks *rtp)
shift++;
WRITE_ONCE(rtp->percpu_enqueue_shift, shift);
WRITE_ONCE(rtp->percpu_dequeue_lim, lim);
- smp_store_release(&rtp->percpu_enqueue_lim, lim);
+ WRITE_ONCE(rtp->percpu_enqueue_lim, lim);
pr_info("%s: Setting shift to %d and lim to %d rcu_task_cb_adjust=%d rcu_task_cpu_ids=%d.\n",
rtp->name, data_race(rtp->percpu_enqueue_shift), data_race(rtp->percpu_enqueue_lim),
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] rcu-tasks: Remove unnecessary smp_store operations in the cblist_init_generic()
2025-12-14 2:49 [PATCH] rcu-tasks: Remove unnecessary smp_store operations in the cblist_init_generic() Zqiang
@ 2025-12-25 18:57 ` Paul E. McKenney
2025-12-31 7:55 ` Zqiang
0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2025-12-25 18:57 UTC (permalink / raw)
To: Zqiang; +Cc: frederic, neeraj.upadhyay, joelagnelf, rcu, linux-kernel
On Sun, Dec 14, 2025 at 10:49:04AM +0800, Zqiang wrote:
> The cblist_init_generic() is executed during the CPU early boot
> phase due to commit:30ef09635b9e ("rcu-tasks: Initialize callback
> lists at rcu_init() time"), at this time, only one boot CPU is
> online. this commit therefore use WRITE_ONCE() to replace the
> smp_store_release() to assigning rtp->percpu_enqueue_lim in the
> cblist_init_generic().
>
> Signed-off-by: Zqiang <qiang.zhang@linux.dev>
Good eyes, thank you!
But in that case, we are running on a single CPU with interrupts disables,
so do we even need WRITE_ONCE()?
Thanx, Paul
> ---
> kernel/rcu/tasks.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> index 76f952196a29..f763f60d5e50 100644
> --- a/kernel/rcu/tasks.h
> +++ b/kernel/rcu/tasks.h
> @@ -292,7 +292,7 @@ static void cblist_init_generic(struct rcu_tasks *rtp)
> shift++;
> WRITE_ONCE(rtp->percpu_enqueue_shift, shift);
> WRITE_ONCE(rtp->percpu_dequeue_lim, lim);
> - smp_store_release(&rtp->percpu_enqueue_lim, lim);
> + WRITE_ONCE(rtp->percpu_enqueue_lim, lim);
>
> pr_info("%s: Setting shift to %d and lim to %d rcu_task_cb_adjust=%d rcu_task_cpu_ids=%d.\n",
> rtp->name, data_race(rtp->percpu_enqueue_shift), data_race(rtp->percpu_enqueue_lim),
> --
> 2.48.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] rcu-tasks: Remove unnecessary smp_store operations in the cblist_init_generic()
2025-12-25 18:57 ` Paul E. McKenney
@ 2025-12-31 7:55 ` Zqiang
0 siblings, 0 replies; 3+ messages in thread
From: Zqiang @ 2025-12-31 7:55 UTC (permalink / raw)
To: paulmck; +Cc: frederic, neeraj.upadhyay, joelagnelf, rcu, linux-kernel
>
> On Sun, Dec 14, 2025 at 10:49:04AM +0800, Zqiang wrote:
>
> >
> > The cblist_init_generic() is executed during the CPU early boot
> > phase due to commit:30ef09635b9e ("rcu-tasks: Initialize callback
> > lists at rcu_init() time"), at this time, only one boot CPU is
> > online. this commit therefore use WRITE_ONCE() to replace the
> > smp_store_release() to assigning rtp->percpu_enqueue_lim in the
> > cblist_init_generic().
> >
> > Signed-off-by: Zqiang <qiang.zhang@linux.dev>
> >
> Good eyes, thank you!
>
> But in that case, we are running on a single CPU with interrupts disables,
> so do we even need WRITE_ONCE()?
I missed the interrupts disabled, It seems like there are no need use WRITE_ONCE()
and include above, I will update and resend.
Thanks
Zqiang
>
> Thanx, Paul
>
> >
> > ---
> > kernel/rcu/tasks.h | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h
> > index 76f952196a29..f763f60d5e50 100644
> > --- a/kernel/rcu/tasks.h
> > +++ b/kernel/rcu/tasks.h
> > @@ -292,7 +292,7 @@ static void cblist_init_generic(struct rcu_tasks *rtp)
> > shift++;
> > WRITE_ONCE(rtp->percpu_enqueue_shift, shift);
> > WRITE_ONCE(rtp->percpu_dequeue_lim, lim);
> > - smp_store_release(&rtp->percpu_enqueue_lim, lim);
> > + WRITE_ONCE(rtp->percpu_enqueue_lim, lim);
> >
> > pr_info("%s: Setting shift to %d and lim to %d rcu_task_cb_adjust=%d rcu_task_cpu_ids=%d.\n",
> > rtp->name, data_race(rtp->percpu_enqueue_shift), data_race(rtp->percpu_enqueue_lim),
> > --
> > 2.48.1
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-31 7:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-14 2:49 [PATCH] rcu-tasks: Remove unnecessary smp_store operations in the cblist_init_generic() Zqiang
2025-12-25 18:57 ` Paul E. McKenney
2025-12-31 7:55 ` Zqiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox