Thread (4 messages) 4 messages, 2 authors, 2020-02-26

Re: [PATCH v2] mm/vmscan: fix data races at kswapd_classzone_idx

From: Matthew Wilcox <willy@infradead.org>
Date: 2020-02-26 04:06:19
Also in: lkml

On Tue, Feb 25, 2020 at 10:58:27PM -0500, Qian Cai wrote:
pgdat->kswapd_classzone_idx could be accessed concurrently in
wakeup_kswapd(). Plain writes and reads without any lock protection
result in data races. Fix them by adding a pair of READ|WRITE_ONCE() as
well as saving a branch (compilers might well optimize the original code
in an unintentional way anyway). While at it, also take care of
pgdat->kswapd_order and non-kswapd threads in allow_direct_reclaim().
I don't understand why the usages of kswapd_classzone_idx in kswapd() and
kswapd_try_to_sleep() don't need changing too?  kswapd_classzone_idx()
looks safe to me, but I'm prone to missing stupid things that compilers
are allowed to do.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help