mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v5 net-next 0/3] udp: Add 4-tuple hash for connected sockets
@ 2024-10-18 11:45 Philo Lu
  2024-10-18 11:45 ` [PATCH v5 net-next 1/3] net/udp: Add a new struct for hash2 slot Philo Lu
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Philo Lu @ 2024-10-18 11:45 UTC (permalink / raw)
  To: netdev
  Cc: willemdebruijn.kernel, davem, edumazet, kuba, pabeni, dsahern,
	antony.antony, steffen.klassert, linux-kernel, dust.li, jakub,
	fred.cc, yubing.qiuyubing

This patchset introduces 4-tuple hash for connected udp sockets, to make
connected udp lookup faster. Test using udpgso_bench_tx/rx shows no
obvious difference w/ and w/o this patchset for unconnected socket
receiving (see v4 thread).

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.

The 4-tuple hash increases the size of udp_sock and udp_hslot. Thus add it
with CONFIG_BASE_SMALL check, i.e., it's a no op with CONFIG_BASE_SMALL.

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:
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

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 (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 |  11 +++
 include/net/udp.h   | 111 +++++++++++++++++++++-
 net/ipv4/udp.c      | 217 +++++++++++++++++++++++++++++++++++++++-----
 net/ipv6/udp.c      |  17 ++--
 4 files changed, 317 insertions(+), 39 deletions(-)

--
2.32.0.3.g01195cf9f


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-10-26  1:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-18 11:45 [PATCH v5 net-next 0/3] udp: Add 4-tuple hash for connected sockets Philo Lu
2024-10-18 11:45 ` [PATCH v5 net-next 1/3] net/udp: Add a new struct for hash2 slot Philo Lu
2024-10-24 14:31   ` Paolo Abeni
2024-10-24 14:38     ` Paolo Abeni
2024-10-18 11:45 ` [PATCH v5 net-next 2/3] net/udp: Add 4-tuple hash list basis Philo Lu
2024-10-18 11:45 ` [PATCH v5 net-next 3/3] ipv4/udp: Add 4-tuple hash for connected socket Philo Lu
2024-10-24 15:01   ` Paolo Abeni
2024-10-24 15:04     ` Paolo Abeni
2024-10-25  3:50     ` Philo Lu
2024-10-25  9:02       ` Paolo Abeni
2024-10-26  1:39         ` Philo Lu

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®