Re: [PATCH] mm: fix a data race in put_page()

From: Qian Cai
Date: Thu Feb 06 2020 - 10:23:36 EST




> On Feb 6, 2020, at 9:55 AM, Jan Kara <jack@xxxxxxx> wrote:
>
> I don't think the problem is real. The question is how to make KCSAN happy
> in a way that doesn't silence other possibly useful things it can find and
> also which makes it most obvious to the reader what's going on... IMHO
> using READ_ONCE() fulfills these targets nicely - it is free
> performance-wise in this case, it silences the checker without impacting
> other races on page->flags, its kind of obvious we don't want the load torn
> in this case so it makes sense to the reader (although a comment may be
> nice).

Actually, use the data_race() macro there fulfilling the same purpose too, i.e, silence the splat here but still keep searching for other races.