lkml.org 
[lkml]   [2020]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2020-04-19 20:30    [W:0.080 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site