[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200419182957.GA36919@carbon>
Date: Sun, 19 Apr 2020 21:29:57 +0300
From: Petko Manolov <petko.manolov@...sulko.com>
To: David Laight <David.Laight@...LAB.COM>
Cc: "Paul E . McKenney" <paulmck@...nel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] WRITE_ONCE_INC() and friends
On 20-04-19 18:02:50, David Laight wrote:
> From: Petko Manolov
> > Sent: 19 April 2020 10:45
> > Recently I started reading up on KCSAN and at some point I ran into stuff like:
> >
> > WRITE_ONCE(ssp->srcu_lock_nesting[idx], ssp->srcu_lock_nesting[idx] + 1);
> > WRITE_ONCE(p->mm->numa_scan_seq, READ_ONCE(p->mm->numa_scan_seq) + 1);
>
> If all the accesses use READ/WRITE_ONCE() why not just mark the structure
> field 'volatile'?
This is a bit heavy. I guess you've read this one:
https://lwn.net/Articles/233479/
And no, i am not sure all accesses are through READ/WRITE_ONCE(). If, for
example, all others are from withing spin_lock/unlock pairs then we _may_ not
need READ/WRITE_ONCE().
I merely proposed the _INC() variant for better readability.
Petko
Powered by blists - more mailing lists