From: Philo Lu <lulie@linux.alibaba.com>
To: 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: [PATCH v4 net-next 0/3] udp: Add 4-tuple hash for connected sockets
Date: Sat, 12 Oct 2024 09:29:15 +0800 [thread overview]
Message-ID: <20241012012918.70888-1-lulie@linux.alibaba.com> (raw)
This patchset introduces 4-tuple hash for connected udp sockets, to make
connected udp lookup faster.
Patch1: Add a new counter for hslot2 named hash4_cnt, to avoid cache line
miss when lookup.
Patch2 and 3: Implement 4-tuple hash for ipv4.
(That for ipv6 is in progress.)
The detailed motivation is described in Patch 3.
AFAICS the patchset can be further improved by:
(a) Better interact with hash2/reuseport. Now hash4 hardly affects other
mechanisms, but maintaining sockets in both hash4 and hash2 lists seems
unnecessary.
(b) Support early demux and ipv6.
changelogs:
v3 -> v4:
- fix mistakes in udp_pernet_table_alloc() (Willem de Bruijn)
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
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 (3):
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
include/linux/udp.h | 7 ++
include/net/udp.h | 44 ++++++++--
net/ipv4/udp.c | 197 ++++++++++++++++++++++++++++++++++++++------
net/ipv6/udp.c | 17 ++--
4 files changed, 225 insertions(+), 40 deletions(-)
--
2.32.0.3.g01195cf9f
next reply other threads:[~2024-10-12 1:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-12 1:29 Philo Lu [this message]
2024-10-12 1:29 ` [PATCH v4 net-next 1/3] net/udp: Add a new struct for hash2 slot Philo Lu
2024-10-12 1:29 ` [PATCH v4 net-next 2/3] net/udp: Add 4-tuple hash list basis Philo Lu
2024-10-14 10:07 ` Paolo Abeni
2024-10-16 6:30 ` Philo Lu
2024-10-16 7:45 ` Paolo Abeni
2024-10-16 8:47 ` Philo Lu
2024-10-17 7:46 ` Philo Lu
2024-10-12 1:29 ` [PATCH v4 net-next 3/3] ipv4/udp: Add 4-tuple hash for connected socket Philo Lu
2024-10-14 10:19 ` Paolo Abeni
2024-10-16 7:28 ` Philo Lu
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=20241012012918.70888-1-lulie@linux.alibaba.com \
--to=lulie@linux.alibaba.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=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=steffen.klassert@secunet.com \
--cc=willemdebruijn.kernel@gmail.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;
as well as URLs for NNTP newsgroup(s).