summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2026-10-05 16:05:02 -0700
committerJakub Kicinski <kuba@kernel.org>2026-10-05 16:05:03 -0700
commit4022ea9c421179edfab4bc2d6fe1ef19f688d651 (patch)
tree205ac2137dc019eb6df6d16a52f5e66e1aaf4413 /include/linux
parent4f07f0bf11aefca661e3413ab4b9b2bd3a1b7b5e (diff)
parent4eee6d58ad1497518b59f8f2c0eb42e258d9cc82 (diff)
Merge branch 'tcp-avoid-struct-socket-cache-line-miss-in-tcp_check_space'
Eric Dumazet says: ==================== tcp: avoid struct socket cache line miss in tcp_check_space() tcp_check_space() is called on every incoming ACK and every transmitted packet, and tests SOCK_NOSPACE in sk->sk_socket->flags. Because struct socket lives in its own cache line and the TCP fast paths do not touch it for anything else, that test pulls in an extra cache line that is cold when the working set of active sockets is large. This series mirrors SOCK_NOSPACE into a new u8 field, tp->tcp_nospace, placed right after tp->chrono_type in the tcp_sock_write_tx cache line group (fitting in an existing 3-byte hole before chrono_start, so no other field moves and sizeof(struct tcp_sock) is unchanged). Both the transmit and ACK fast paths already touch that cache line, making the fast-path test in tcp_check_space() free of extra cache misses while keeping __tcp_check_space() authoritative on SOCK_NOSPACE. To maintain the invariant (SOCK_NOSPACE set => tp->tcp_nospace set) from a single choke point: - Patch 1 fixes a long-standing bug in dlm where SOCKWQ_ASYNC_NOSPACE was tested and cleared on con->sock->flags instead of SOCK_NOSPACE. - Patch 2 introduces sk_set_nospace() and sk_clear_nospace() and converts the core networking setters and clearers. - Patches 3-8 convert the remaining in-kernel callers (sunrpc, rds, dlm, drbd, nvme-tcp, libceph) so that no open-coded set_bit() or clear_bit() of SOCK_NOSPACE remains in the tree. - Patch 9 adds tp->tcp_nospace, wires it into sk_set_nospace() and sk_clear_nospace(), and switches tcp_check_space() to test it. ==================== Link: https://patch.msgid.link/20260929071743.23624-1-edumazet@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/tcp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 6a8c77719322..e4d1720f49f0 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -269,6 +269,9 @@ struct tcp_sock {
*/
u32 snd_sml; /* Last byte of the most recently transmitted small packet */
u8 chrono_type; /* current chronograph type */
+ u8 tcp_nospace; /* mirrors SOCK_NOSPACE, must be set whenever
+ * SOCK_NOSPACE is set.
+ */
u32 chrono_start; /* Start time in jiffies of a TCP chrono */
u32 chrono_stat[3]; /* Time in jiffies for chrono_stat stats */
u32 write_seq; /* Tail(+1) of data held in tcp send buffer */