Re: [PATCH cgroup/for-5.5] cgroup: remove cgroup_enable_task_cg_lists() optimization

From: Marco Elver
Date: Mon Oct 28 2019 - 13:47:00 EST



On Mon, 28 Oct 2019, Christian Brauner wrote:

> On Mon, Oct 28, 2019 at 05:48:52PM +0100, Oleg Nesterov wrote:
> > On 10/25, Christian Brauner wrote:
> >
> > It is not that this code lacked READ_ONCE(). I am sure me and others
> > understood that this code can read ->exit_state more than once, just
> > nobody noticed that in this case this is really wrong.
> >
> > IOW, if we simply change the code before 3245d6acab98 to use READ_ONCE()
> > the code will be equally wrong, and
> >
> > > and as far as I understand this would also help kcsan to better detect
> > > races.
> >
> > this change will simply hide the problem from kcsan.
>
> I can't speak to that since the claim that read_once() helps them even
> if it's not really doing anything. But maybe I misunderstood the
> k{c,t}san manpage.

What Oleg said is right: marking things _ONCE will make these accesses
no longer be data races, and KCSAN would then no longer report these as
data race, even if the code is still buggy due to there being a race
condition. In this case, the race condition would stop also being a data
race, and we'd no longer find it.

Thanks,
-- Marco