diff mbox series

[net-next] tcp: remove some holes in struct tcp_sock

Message ID 20240227192721.3558982-1-edumazet@google.com (mailing list archive)
State Accepted
Commit 99123622050f10ca9148a0fffba2de0afd6cdfff
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tcp: remove some holes in struct tcp_sock | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next, async
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 3025 this patch: 3025
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 2 of 2 maintainers
netdev/build_clang success Errors and warnings before: 1008 this patch: 1008
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 3240 this patch: 3240
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 47 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-02-28--18-00 (tests: 882)

Commit Message

Eric Dumazet Feb. 27, 2024, 7:27 p.m. UTC
By moving some fields around, this patch shrinks
holes size from 56 to 32, saving 24 bytes on 64bit arches.

After the patch pahole gives the following for 'struct tcp_sock':

	/* size: 2304, cachelines: 36, members: 162 */
	/* sum members: 2234, holes: 6, sum holes: 32 */
	/* sum bitfield members: 34 bits, bit holes: 5, sum bit holes: 14 bits */
	/* padding: 32 */
	/* paddings: 3, sum paddings: 10 */
	/* forced alignments: 1, forced holes: 1, sum forced holes: 12 */

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/linux/tcp.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Jiri Pirko Feb. 28, 2024, 7:56 a.m. UTC | #1
Tue, Feb 27, 2024 at 08:27:21PM CET, edumazet@google.com wrote:
>By moving some fields around, this patch shrinks
>holes size from 56 to 32, saving 24 bytes on 64bit arches.
>
>After the patch pahole gives the following for 'struct tcp_sock':
>
>	/* size: 2304, cachelines: 36, members: 162 */
>	/* sum members: 2234, holes: 6, sum holes: 32 */
>	/* sum bitfield members: 34 bits, bit holes: 5, sum bit holes: 14 bits */
>	/* padding: 32 */
>	/* paddings: 3, sum paddings: 10 */
>	/* forced alignments: 1, forced holes: 1, sum forced holes: 12 */
>
>Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Jiri Pirko <jiri@nvidia.com>
patchwork-bot+netdevbpf@kernel.org Feb. 29, 2024, 4:40 a.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 27 Feb 2024 19:27:21 +0000 you wrote:
> By moving some fields around, this patch shrinks
> holes size from 56 to 32, saving 24 bytes on 64bit arches.
> 
> After the patch pahole gives the following for 'struct tcp_sock':
> 
> 	/* size: 2304, cachelines: 36, members: 162 */
> 	/* sum members: 2234, holes: 6, sum holes: 32 */
> 	/* sum bitfield members: 34 bits, bit holes: 5, sum bit holes: 14 bits */
> 	/* padding: 32 */
> 	/* paddings: 3, sum paddings: 10 */
> 	/* forced alignments: 1, forced holes: 1, sum forced holes: 12 */
> 
> [...]

Here is the summary with links:
  - [net-next] tcp: remove some holes in struct tcp_sock
    https://git.kernel.org/netdev/net-next/c/99123622050f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index a1c47a6d69b0efd7e62765fbd873c848da22aaec..988a30ef6bfe956fa573f1f18c8284aa382dc1cc 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -264,10 +264,10 @@  struct tcp_sock {
 	u32	pushed_seq;	/* Last pushed seq, required to talk to windows */
 	u32	lsndtime;
 	u32	mdev_us;	/* medium deviation			*/
+	u32	rtt_seq;	/* sequence number to update rttvar	*/
 	u64	tcp_wstamp_ns;	/* departure time for next sent data packet */
 	u64	tcp_clock_cache; /* cache last tcp_clock_ns() (see tcp_mstamp_refresh()) */
 	u64	tcp_mstamp;	/* most recent packet received/sent */
-	u32	rtt_seq;	/* sequence number to update rttvar	*/
 	struct list_head tsorted_sent_queue; /* time-sorted sent but un-SACKed skbs */
 	struct sk_buff *highest_sack;   /* skb just after the highest
 					 * skb with SACKed bit set
@@ -350,7 +350,6 @@  struct tcp_sock {
 	u32	dsack_dups;	/* RFC4898 tcpEStatsStackDSACKDups
 				 * total number of DSACK blocks received
 				 */
-	u32	last_oow_ack_time;  /* timestamp of last out-of-window ACK */
 	u32	compressed_ack_rcv_nxt;
 	struct list_head tsq_node; /* anchor in tsq_tasklet.head list */
 
@@ -384,12 +383,12 @@  struct tcp_sock {
 		syn_fastopen_ch:1, /* Active TFO re-enabling probe */
 		syn_data_acked:1;/* data in SYN is acked by SYN-ACK */
 
+	u8	keepalive_probes; /* num of allowed keep alive probes	*/
 	u32	tcp_tx_delay;	/* delay (in usec) added to TX packets */
 
 /* RTT measurement */
 	u32	mdev_max_us;	/* maximal mdev for the last rtt period	*/
 
-	u8	keepalive_probes; /* num of allowed keep alive probes	*/
 	u32	reord_seen;	/* number of data packet reordering events */
 
 /*
@@ -402,6 +401,7 @@  struct tcp_sock {
 	u32	prior_cwnd;	/* cwnd right before starting loss recovery */
 	u32	prr_delivered;	/* Number of newly delivered packets to
 				 * receiver in Recovery. */
+	u32	last_oow_ack_time;  /* timestamp of last out-of-window ACK */
 
 	struct hrtimer	pacing_timer;
 	struct hrtimer	compressed_ack_timer;
@@ -477,8 +477,8 @@  struct tcp_sock {
 	bool	is_mptcp;
 #endif
 #if IS_ENABLED(CONFIG_SMC)
-	bool	(*smc_hs_congested)(const struct sock *sk);
 	bool	syn_smc;	/* SYN includes SMC */
+	bool	(*smc_hs_congested)(const struct sock *sk);
 #endif
 
 #if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)