| From: |
| Philo Lu <lulie-AT-linux.alibaba.com> |
| To: |
| netdev-AT-vger.kernel.org |
| Subject: |
| [RFC PATCHv2 net-next 0/3] udp: Add 4-tuple hash for connected sockets |
| Date: |
| Tue, 24 Sep 2024 19:04:11 +0800 |
| Message-ID: |
| <20240924110414.52618-1-lulie@linux.alibaba.com> |
| Cc: |
| willemdebruijn.kernel-AT-gmail.com, davem-AT-davemloft.net, edumazet-AT-google.com, kuba-AT-kernel.org, pabeni-AT-redhat.com, dsahern-AT-kernel.org, antony.antony-AT-secunet.com, steffen.klassert-AT-secunet.com, linux-kernel-AT-vger.kernel.org, dust.li-AT-linux.alibaba.com, jakub-AT-cloudflare.com, fred.cc-AT-alibaba-inc.com, yubing.qiuyubing-AT-alibaba-inc.com |
| Archive-link: |
| Article |
This RFC patchset introduces 4-tuple hash for connected udp sockets, to
make connected udp lookup faster. It is a tentative proposal and any
comment is welcome.
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.
The detailed motivation is described in Patch 3.
AFAICT 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:
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
RFCv1:
https://lore.kernel.org/all/20240913100941.8565-1-lulie@l...
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, 223 insertions(+), 42 deletions(-)
--
2.32.0.3.g01195cf9f