udp: Add 4-tuple hash for connected sockets
Status from this message: This series was applied to netdev/net-next.git (main)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v9 Latest4 patches 0 repliesApplied 4/4
- v84 patches 4 repliesSuperseded
- v74 patches 1 replySuperseded
Earlier versions · 6
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v6 | 4 patches | 2 replies | Superseded | |
| v5 | 3 patches | 7 replies | Superseded | |
| v4 | 3 patches | 7 replies | Superseded | |
| v3 | 3 patches | 5 replies | Superseded | |
| v2 RFC | 3 patches | 0 replies | Superseded | |
| v1 RFC | 1 patch | 7 replies | Superseded |
Changes in v9 from the cover letter
- Add explanation about udplite in cover letter
- Update tags for co-developers
- Add acked-by tags of Paolo and Willem
Patches in v9 All 4 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | net/udp: Add a new struct for hash2 slotinclude/ net/ net/ | +63 | 0 replies | Applied |
| 2/4 | net/udp: Add 4-tuple hash list basisinclude/ include/ net/ | +97 | 0 replies | Applied |
| 3/4 | ipv4/udp: Add 4-tuple hash for connected socketinclude/ net/ net/ | +210 | 0 replies | Applied |
| 4/4 | ipv6/udp: Add 4-tuple hash for connected socketinclude/ net/ net/ | +103 | 0 replies | Applied |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Willem de Bruijn | Paolo Abeni |
|---|---|---|
| 1/4 | A-b | A-b |
| 2/4 | A-b | A-b |
| 3/4 | A-b | A-b |
| 4/4 | A-b | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v9 net-next 0/4] udp: Add 4-tuple hash for connected sockets
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.
Intentionally, the feature is not available for udplite. Though udplite shares some structs and functions with udp, its connect() keeps unchanged. So all udplite sockets perform the same as un-connected udp sockets. Besides, udplite also shares the additional memory consumption in udp_sock and udptable.
changelogs:
v8 -> v9 (Paolo Abeni):
- Add explanation about udplite in cover letter
- Update tags for co-developers
- Add acked-by tags of Paolo and Willem
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
v8:
https://lore.kernel.org/all/[email protected]/
v7:
https://lore.kernel.org/all/[email protected]/
v6:
https://lore.kernel.org/all/[email protected]/
v5:
https://lore.kernel.org/all/[email protected]/
v4:
https://lore.kernel.org/all/[email protected]/
v3:
https://lore.kernel.org/all/[email protected]/
RFCv2:
https://lore.kernel.org/all/[email protected]/
RFCv1:
https://lore.kernel.org/all/[email protected]/
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(-)
Signature · 1 line
2.32.0.3.g01195cf9f