tcp: tweak tcp_sock_write_txrx size assertion
Subsystems (3)
PATCH 1/1 tcp: tweak tcp_sock_write_txrx size assertion
I forgot 32bit arches might have 64bit alignment for u64 fields.
tcp_sock_write_txrx group does not contain pointers, but two u64 fields. It is possible that on 32bit kernel, a 32bit hole is before tp->tcp_clock_cache.
I will try to remember a group can be bigger on 32bit kernels in the future.
With help from Vladimir Oltean.
--- net/ipv4/tcp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +5 -1
@@ -4673,7 +4673,11 @@ static void __init tcp_struct_check(void) CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, app_limited); CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rcv_wnd); CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_txrx, rx_opt); - CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92); + +/* 32bit arches with 8byte alignment on u64 fields might need padding +* before tcp_clock_cache. +*/ + CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 92 + 4);/* RX read-write hotpath cache lines */ CACHELINE_ASSERT_GROUP_MEMBER(struct tcp_sock, tcp_sock_write_rx, bytes_received);
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Quoted 10 lines · Eric Dumazet
I forgot 32bit arches might have 64bit alignment for u64 fields.
tcp_sock_write_txrxgroup does not contain pointers, but two u64 fields. It is possible that on 32bit kernel, a 32bit hole is beforetp->tcp_clock_cache.I will try to remember a group can be bigger on 32bit kernels in the future.
Quoted 8 lines
With help from Vladimir Oltean.
Fixes d2c3a7eb1afa ("tcp: more struct tcp_sock adjustments")Reported-by kernel test robot <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Cc Vladimir Oltean <[email protected]>---
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Tue, 9 Apr 2024 14:09:14 +0000 you wrote:
I forgot 32bit arches might have 64bit alignment for u64 fields.
tcp_sock_write_txrxgroup does not contain pointers, but two u64 fields. It is possible that on 32bit kernel, a 32bit hole is beforetp->tcp_clock_cache.[...]
Here is the summary with links:
- [net-next] tcp: tweak tcp_sock_write_txrx size assertion
https://git.kernel.org/netdev/net-next/c/9b9fd45869e7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html