mirror of https://lore.kernel.org/lkml/
 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,  horms@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 v8 net-next 0/4] udp: Add 4-tuple hash for connected sockets
Date: Mon, 11 Nov 2024 12:58:09 -0500	[thread overview]
Message-ID: <673245b18be9c_b4a05294bc@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <20241108054836.123484-1-lulie@linux.alibaba.com>

Philo Lu wrote:
> This patchset introduces 4-tuple hash for connected udp sockets, to make
> connected udp lookup faster.
> 
> Stress test results (with 1 cpu fully used) are shown below, in pps:
> (1) _un-connected_ socket as server
>     [a] w/o hash4: 1,825176
>     [b] w/  hash4: 1,831750 (+0.36%)
> 
> (2) 500 _connected_ sockets as server
>     [c] w/o hash4:   290860 (only 16% of [a])
>     [d] w/  hash4: 1,889658 (+3.1% compared with [b])
> With hash4, compute_score is skipped when lookup, so [d] is slightly
> better than [b].
> 
> Patch1: Add a new counter for hslot2 named hash4_cnt, to avoid cache line
>         miss when lookup.
> Patch2: Add hslot/hlist_nulls for 4-tuple hash.
> Patch3 and 4: Implement 4-tuple hash for ipv4 and ipv6.
> 
> The detailed motivation is described in Patch 3.
> 
> The 4-tuple hash increases the size of udp_sock and udp_hslot. Thus add it
> with CONFIG_BASE_SMALL, i.e., it's a no op with CONFIG_BASE_SMALL.
> 
> changelogs:
> v7 -> v8:
> - add EXPORT_SYMBOL for ipv6.ko build
> 
> v6 -> v7 (Kuniyuki Iwashima):
> - export udp_ehashfn to be used by udpv6 rehash
> 
> v5 -> v6 (Paolo Abeni):
> - move udp_table_hash4_init from patch2 to patch1
> - use hlist_nulls for lookup-rehash race
> - add test results in commit log
> - add more comment, e.g., for rehash4 used in hash4
> - add ipv6 support (Patch4), and refactor some functions for better
>   sharing, without functionality change
> 
> v4 -> v5 (Paolo Abeni):
> - add CONFIG_BASE_SMALL with which udp hash4 does nothing
> 
> v3 -> v4 (Willem de Bruijn):
> - fix mistakes in udp_pernet_table_alloc()
> 
> RFCv2 -> v3 (Gur Stavi):
> - minor fix in udp_hashslot2() and udp_table_init()
> - add rcu sync in rehash4()
> 
> RFCv1 -> RFCv2:
> - add a new struct for hslot2
> - remove the sockopt UDP_HASH4 because it has little side effect for
>   unconnected sockets
> - add rehash in connect()
> - re-organize the patch into 3 smaller ones
> - other minor fix
> 
> v7:
> https://lore.kernel.org/all/20241105121225.12513-1-lulie@linux.alibaba.com/
> v6:
> https://lore.kernel.org/all/20241031124550.20227-1-lulie@linux.alibaba.com/
> v5:
> https://lore.kernel.org/all/20241018114535.35712-1-lulie@linux.alibaba.com/
> v4:
> https://lore.kernel.org/all/20241012012918.70888-1-lulie@linux.alibaba.com/
> v3:
> https://lore.kernel.org/all/20241010090351.79698-1-lulie@linux.alibaba.com/
> RFCv2:
> https://lore.kernel.org/all/20240924110414.52618-1-lulie@linux.alibaba.com/
> RFCv1:
> https://lore.kernel.org/all/20240913100941.8565-1-lulie@linux.alibaba.com/
> 
> Philo Lu (4):
>   net/udp: Add a new struct for hash2 slot
>   net/udp: Add 4-tuple hash list basis
>   ipv4/udp: Add 4-tuple hash for connected socket
>   ipv6/udp: Add 4-tuple hash for connected socket
> 
>  include/linux/udp.h |  11 ++
>  include/net/udp.h   | 137 +++++++++++++++++++++++--
>  net/ipv4/udp.c      | 245 +++++++++++++++++++++++++++++++++++++++-----
>  net/ipv6/udp.c      | 117 +++++++++++++++++++--
>  4 files changed, 468 insertions(+), 42 deletions(-)

Acked-by: Willem de Bruijn <willemb@google.com>

My expertise in routing is limited, fair warning.
But I see no significant remaining issues.


      parent reply	other threads:[~2024-11-11 17:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  5:48 Philo Lu
2024-11-08  5:48 ` [PATCH v8 net-next 1/4] net/udp: Add a new struct for hash2 slot Philo Lu
2024-11-08  5:48 ` [PATCH v8 net-next 2/4] net/udp: Add 4-tuple hash list basis Philo Lu
2024-11-08  5:48 ` [PATCH v8 net-next 3/4] ipv4/udp: Add 4-tuple hash for connected socket Philo Lu
2024-11-12 14:58   ` Paolo Abeni
2024-11-13  1:50     ` Philo Lu
2024-11-14  9:12       ` Paolo Abeni
2024-11-08  5:48 ` [PATCH v8 net-next 4/4] ipv6/udp: " Philo Lu
2024-11-11 17:58 ` Willem de Bruijn [this message]

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=673245b18be9c_b4a05294bc@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=horms@kernel.org \
    --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

all inboxes | Powered by JetHome®