On Sat, Feb 04, 2017 at 07:19:37AM -0800, Eric Dumazet wrote:
>
> > The comment says that it's pairing with an mb in tcp_poll, but
> > tcp_poll doesn't touch QUEUE_SHRUNK at all.  So what exactly is
> > this barrier for?
> 
> Do not focus on QUEUE_SHRUNK flag, which is locally used by this thread
> only.
> 
> The confusion comes because 3c7151275c0c9a80c3375f9874b1c7129a105eea
> thought it could avoid the cost of smp_mb() by abusing the fact that
> sock_reset_flag(sk, SOCK_QUEUE_SHRUNK) was doing an atomic,
> but it was not.

Thanks for the explanation.  I see what it's protecting now.  And
this could indeed be responsible for the race that Oleg reported.
-- 
Email: Herbert Xu <herb...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Reply via email to