[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f5f9c542-2b23-9df9-098c-ad4007bf7e78@akamai.com>
Date: Mon, 23 Jan 2017 11:56:18 -0500
From: Jason Baron <jbaron@...mai.com>
To: Oleg Nesterov <oleg@...hat.com>,
"David S. Miller" <davem@...emloft.net>
Cc: Herbert Xu <herbert.xu@...hat.com>,
Yauheni Kaliuta <yauheni.kaliuta@...hat.com>,
netdev@...r.kernel.org, Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: wrong smp_mb__after_atomic() in tcp_check_space() ?
On 01/23/2017 09:30 AM, Oleg Nesterov wrote:
> Hello,
>
> smp_mb__after_atomic() looks wrong and misleading, sock_reset_flag() does the
> non-atomic __clear_bit() and thus it can not guarantee test_bit(SOCK_NOSPACE)
> (non-atomic too) won't be reordered.
>
Indeed. Here's a bit of discussion on it:
http://marc.info/?l=linux-netdev&m=146662325920596&w=2
> It was added by 3c7151275c0c9a "tcp: add memory barriers to write space paths"
> and the patch looks correct in that we need the barriers in tcp_check_space()
> and tcp_poll() in theory, so it seems tcp_check_space() needs smp_mb() ?
>
Yes, I think it should be upgraded to an smp_mb() there. If you agree
with this analysis, I will send a patch to upgrade it. Note, I did not
actually run into this race in practice.
Thanks,
-Jason
Powered by blists - more mailing lists