Re: [PATCH] kernel: fix data race in put_pid

Oleg Nesterov
2015-09-18T15:33:11Z

I can't resist. You certainly don't need this spam, but

On 09/18, Peter Zijlstra wrote:
>
> On Fri, Sep 18, 2015 at 03:28:44PM +0200, Oleg Nesterov wrote:
> >
> > And again, I simply can't understand if this code
> >
> > if (READ_ONCE_CTRL(Y))
> > BUG_ON(X == 0);
> >
> > to me it does _not_ look correct in theory.
>
> So control dependencies provide a load-store barrier. Your examples
> above rely on a load-load barrier; BUG_ON(X == 0) is a load.

Yes, and this is just obvious.

Yet I was confused because reading other emails I misunderstood the
proposed semantics of atomic_read_ctrl(), so I started to suspect
that in fact _CTRL() does more than I used to think.

Nevermind, sorry for noise, thanks to all.

Oleg.