Re: [PATCH rcu 2/7] docs: Improve discussion of this_cpu_ptr(), add raw_cpu_ptr()

From: Paul E. McKenney
Date: Thu Jan 16 2025 - 17:57:12 EST


On Thu, Jan 16, 2025 at 09:02:16PM +0000, Matthew Wilcox wrote:
> On Thu, Jan 16, 2025 at 12:02:34PM -0800, Paul E. McKenney wrote:
> > +The special cases where it makes sense do obtain a per-CPU pointer in
>
> s/do/to/
>
> > +preemptible code are addressed by raw_cpu_ptr(), but please note that such
>
> s/please note that //

Good eyes, thank you! I am a bit sorry to see the "please note that"
go, but I suppose fewer words is a good thing.

I will fix these on my next rebase and repost.

Thanx, Paul

> > +use cases need to handle cases where two different CPUs are accessing
> > +the same per cpu variable, which might well be that of a third CPU.
> > +These use cases are typically performance optimizations. For example,
> > +SRCU implements a pair of counters as a pair of per-CPU variables,
> > +and rcu_read_lock_nmisafe() uses raw_cpu_ptr() to get a pointer to some
> > +CPU's counter, and uses atomic_inc_long() to handle migration between
> > +the raw_cpu_ptr() and the atomic_inc_long().