Netdev List
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Jason Baron <jbaron@akamai.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org,
	eric.dumazet@gmail.com, oleg@redhat.com
Subject: Re: [PATCH net] tcp: correct memory barrier usage in tcp_check_space()
Date: Sat, 4 Feb 2017 17:59:54 +0800	[thread overview]
Message-ID: <20170204095954.GA5916@gondor.apana.org.au> (raw)
In-Reply-To: <1485312581-13041-1-git-send-email-jbaron@akamai.com>

Jason Baron <jbaron@akamai.com> wrote:
> From: Jason Baron <jbaron@akamai.com>
> 
> sock_reset_flag() maps to __clear_bit() not the atomic version clear_bit().
> Thus, we need smp_mb(), smp_mb__after_atomic() is not sufficient.
> 
> Fixes: 3c7151275c0c ("tcp: add memory barriers to write space paths")
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Signed-off-by: Jason Baron <jbaron@akamai.com>

This patch makes no sense.

> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
> index bfa165cc455a..1e22ae4a5b38 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -5028,7 +5028,7 @@ static void tcp_check_space(struct sock *sk)
>        if (sock_flag(sk, SOCK_QUEUE_SHRUNK)) {
>                sock_reset_flag(sk, SOCK_QUEUE_SHRUNK);
>                /* pairs with tcp_poll() */
> -               smp_mb__after_atomic();
> +               smp_mb();
>                if (sk->sk_socket &&
>                    test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) {
>                        tcp_new_space(sk);

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?

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

  parent reply	other threads:[~2017-02-04 10:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-25  2:49 [PATCH net] tcp: correct memory barrier usage in tcp_check_space() Jason Baron
2017-01-25  4:53 ` Eric Dumazet
2017-01-25 18:23   ` David Miller
2017-02-04  9:59 ` Herbert Xu [this message]
2017-02-04 15:19   ` Eric Dumazet
2017-02-04 15:57     ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170204095954.GA5916@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jbaron@akamai.com \
    --cc=netdev@vger.kernel.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox