mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: maowenan <maowenan@huawei.com>, Eric Dumazet <edumazet@google.com>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net v2] tcp: avoid creating multiple req socks with the same tuples
Date: Thu, 13 Jun 2019 21:28:21 -0700	[thread overview]
Message-ID: <6aa69ab5-ed81-6a7f-2b2b-214e44ff0ada@gmail.com> (raw)
In-Reply-To: <a674e90e-d06f-cb67-604f-30cb736d7c72@huawei.com>



On 6/13/19 9:19 PM, maowenan wrote:
> 
> 
> @Eric, for this issue I only want to check TCP_NEW_SYN_RECV sk, is it OK like below?
>  +       if (!osk && sk->sk_state == TCP_NEW_SYN_RECV)
>  +               reqsk = __inet_lookup_established(sock_net(sk), &tcp_hashinfo,
>  +                                                       sk->sk_daddr, sk->sk_dport,
>  +                                                       sk->sk_rcv_saddr, sk->sk_num,
>  +                                                       sk->sk_bound_dev_if, sk->sk_bound_dev_if);
>  +       if (unlikely(reqsk)) {
> 

Not enough.

If we have many cpus here, there is a chance another cpu has inserted a request socket, then
replaced it by an ESTABLISH socket for the same 4-tuple.

We need to take the per bucket spinlock much sooner.

And this is fine, all what matters is that we do no longer grab the listener spinlock.

  reply	other threads:[~2019-06-14  4:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12  3:57 Mao Wenan
2019-06-12 16:25 ` David Miller
2019-06-13  6:34   ` maowenan
2019-06-12 16:30 ` Eric Dumazet
2019-06-13  4:21   ` maowenan
2019-06-14  4:19     ` maowenan
2019-06-14  4:28       ` Eric Dumazet [this message]
2019-06-14  9:35         ` maowenan
2019-06-14 12:27           ` Eric Dumazet
2019-06-14 14:03             ` maowenan
2019-06-14 14:25               ` Eric Dumazet
2019-06-14 14:34                 ` Eric Dumazet

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=6aa69ab5-ed81-6a7f-2b2b-214e44ff0ada@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maowenan@huawei.com \
    --cc=netdev@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®