lkml.org 
[lkml]   [2022]   [Jun]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 2/3] mm/swapfile: fix possible data races of inuse_pages
On Mon, Jun 20, 2022 at 10:20:07PM +0800, Muchun Song wrote:
> The lock does not protect the read sides. So the write side should be
> fixed by WRITTE_ONCE().

https://lwn.net/Articles/816854/

"Unmarked writes (aligned and up to word size) can be treated as if they had
used WRITE_ONCE() by building with
CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=y (also selected by default).
Experience has shown that compilers are much less likely to destructively
optimize in-kernel writes than reads. Some developers might therefore
choose to use READ_ONCE() but omit the corresponding WRITE_ONCE(). Other
developers might prefer the documentation benefits and long-term peace of
mind accruing from explicit use of WRITE_ONCE()..."

\
 
 \ /
  Last update: 2022-06-20 23:38    [W:0.064 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site