Netdev List
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Philo Lu <lulie@linux.alibaba.com>,  netdev@vger.kernel.org
Cc: willemdebruijn.kernel@gmail.com,  davem@davemloft.net,
	 edumazet@google.com,  kuba@kernel.org,  pabeni@redhat.com,
	 dsahern@kernel.org,  antony.antony@secunet.com,
	 steffen.klassert@secunet.com,  linux-kernel@vger.kernel.org,
	 dust.li@linux.alibaba.com,  jakub@cloudflare.com,
	 fred.cc@alibaba-inc.com,  yubing.qiuyubing@alibaba-inc.com
Subject: Re: [PATCH v3 net-next 3/3] ipv4/udp: Add 4-tuple hash for connected socket
Date: Thu, 10 Oct 2024 09:49:40 -0400	[thread overview]
Message-ID: <6707db74601d9_20292129449@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <20241010090351.79698-4-lulie@linux.alibaba.com>

Philo Lu wrote:
> Currently, the udp_table has two hash table, the port hash and portaddr
> hash. Usually for UDP servers, all sockets have the same local port and
> addr, so they are all on the same hash slot within a reuseport group.
> 
> In some applications, UDP servers use connect() to manage clients. In
> particular, when firstly receiving from an unseen 4 tuple, a new socket
> is created and connect()ed to the remote addr:port, and then the fd is
> used exclusively by the client.
> 
> Once there are connected sks in a reuseport group, udp has to score all
> sks in the same hash2 slot to find the best match. This could be
> inefficient with a large number of connections, resulting in high
> softirq overhead.
> 
> To solve the problem, this patch implement 4-tuple hash for connected
> udp sockets. During connect(), hash4 slot is updated, as well as a
> corresponding counter, hash4_cnt, in hslot2. In __udp4_lib_lookup(),
> hslot4 will be searched firstly if the counter is non-zero. Otherwise,
> hslot2 is used like before. Note that only connected sockets enter this
> hash4 path, while un-connected ones are not affected.
> 
> Signed-off-by: Philo Lu <lulie@linux.alibaba.com>
> Signed-off-by: Cambda Zhu <cambda@linux.alibaba.com>
> Signed-off-by: Fred Chen <fred.cc@alibaba-inc.com>
> Signed-off-by: Yubing Qiu <yubing.qiuyubing@alibaba-inc.com>

> diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
> index bbf3352213c4..4d3dfcb48a39 100644
> --- a/net/ipv6/udp.c
> +++ b/net/ipv6/udp.c
> @@ -111,7 +111,7 @@ void udp_v6_rehash(struct sock *sk)
>  					  &sk->sk_v6_rcv_saddr,
>  					  inet_sk(sk)->inet_num);
>  
> -	udp_lib_rehash(sk, new_hash);
> +	udp_lib_rehash(sk, new_hash, 0); /* 4-tuple hash not implemented */

What is the plan for IPv6?




  reply	other threads:[~2024-10-10 13:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-10  9:03 [PATCH v3 net-next 0/3] udp: Add 4-tuple hash for connected sockets Philo Lu
2024-10-10  9:03 ` [PATCH v3 net-next 1/3] net/udp: Add a new struct for hash2 slot Philo Lu
2024-10-10  9:03 ` [PATCH v3 net-next 2/3] net/udp: Add 4-tuple hash list basis Philo Lu
2024-10-10 13:48   ` Willem de Bruijn
2024-10-11  1:23     ` Philo Lu
2024-10-10  9:03 ` [PATCH v3 net-next 3/3] ipv4/udp: Add 4-tuple hash for connected socket Philo Lu
2024-10-10 13:49   ` Willem de Bruijn [this message]
2024-10-11  1:37     ` Philo Lu
2024-10-11 14:50       ` Willem de Bruijn

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=6707db74601d9_20292129449@willemb.c.googlers.com.notmuch \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=antony.antony@secunet.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=fred.cc@alibaba-inc.com \
    --cc=jakub@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lulie@linux.alibaba.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=steffen.klassert@secunet.com \
    --cc=yubing.qiuyubing@alibaba-inc.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