net: introduce net_aligned_data
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
- v2 Latest4 patches 0 repliesApplied 4/4
- v14 patches 4 repliesSuperseded
Patches in v2 All 4 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | net: add struct net_aligned_datainclude/ net/ | +19 | 0 replies | Applied |
| 2/4 | net: move net_cookie into net_aligned_datainclude/ net/ | +4 | 0 replies | Applied |
| 3/4 | tcp: move tcp_memory_allocated into net_aligned_datainclude/ include/ net/ +4 more | +11 | 0 replies | Applied |
| 4/4 | udp: move udp_memory_allocated into net_aligned_datainclude/ include/ net/ +5 more | +7 | 0 replies | Applied |
Reviews trailers per patch
All 4 patches have a Reviewed-by or Acked-by.
| Patch | Willem de Bruijn |
|---|---|
| 1/4 | R-b |
| 2/4 | R-b |
| 3/4 | R-b |
| 4/4 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 net-next 0/4] net: introduce net_aligned_data
____cacheline_aligned_in_smp on small fields like tcp_memory_allocated and udp_memory_allocated is not good enough.
It makes sure to put these fields at the start of a cache line, but does not prevent the linker from using the cache line for other fields, with potential performance impact.
nm -v vmlinux|egrep -5 "tcp_memory_allocated|udp_memory_allocated"
...ffffffff83e35cc0 B tcp_memory_allocatedffffffff83e35cc8 b __key.0ffffffff83e35cc8 b __tcp_tx_delay_enabled.1ffffffff83e35ce0 b tcp_orphan_timer
...ffffffff849dddc0 B udp_memory_allocatedffffffff849dddc8 B udp_encap_needed_keyffffffff849dddd8 B udpv6_encap_needed_keyffffffff849dddf0 b inetsw_lock
One solution is to move these sensitive fields to a structure, so that the compiler is forced to add empty holes between each member.
nm -v vmlinux|egrep -2 "tcp_memory_allocated|udp_memory_allocated|net_aligned_data"
ffffffff885af970 b mem_id_initffffffff885af980 b __key.0ffffffff885af9c0 B net_aligned_dataffffffff885afa80 B page_pool_mem_providersffffffff885afa90 b __key.2
v2: added <linux/atomic.h>, report from kernel test robot <[email protected]>
v1: https://lore.kernel.org/netdev/[email protected]/
Eric Dumazet (4):
net: add struct net_aligned_data
net: move net_cookie into net_aligned_data
tcp: move tcp_memory_allocated into net_aligned_data
udp: move udp_memory_allocated into net_aligned_data
include/net/aligned_data.h | 22 ++++++++++++++++++++++ include/net/tcp.h | 1 - include/net/udp.h | 1 - net/core/hotdata.c | 5 +++++ net/core/net_namespace.c | 8 ++------ net/ipv4/tcp.c | 2 -- net/ipv4/tcp_ipv4.c | 3 ++- net/ipv4/udp.c | 4 +--- net/ipv4/udp_impl.h | 1 + net/ipv4/udplite.c | 2 +- net/ipv6/tcp_ipv6.c | 3 ++- net/ipv6/udp.c | 2 +- net/ipv6/udp_impl.h | 1 + net/ipv6/udplite.c | 2 +- net/mptcp/protocol.c | 3 ++- 15 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 include/net/aligned_data.h
Signature · 1 line
2.50.0.727.gbf7dc18ff4-goog