Skip to content

Commit 9912362

Browse files
edumazetkuba-moo
authored andcommitted
tcp: remove some holes in struct tcp_sock
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> Link: https://lore.kernel.org/r/20240227192721.3558982-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 82a48af commit 9912362

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

include/linux/tcp.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ struct tcp_sock {
264264
u32 pushed_seq; /* Last pushed seq, required to talk to windows */
265265
u32 lsndtime;
266266
u32 mdev_us; /* medium deviation */
267+
u32 rtt_seq; /* sequence number to update rttvar */
267268
u64 tcp_wstamp_ns; /* departure time for next sent data packet */
268269
u64 tcp_clock_cache; /* cache last tcp_clock_ns() (see tcp_mstamp_refresh()) */
269270
u64 tcp_mstamp; /* most recent packet received/sent */
270-
u32 rtt_seq; /* sequence number to update rttvar */
271271
struct list_head tsorted_sent_queue; /* time-sorted sent but un-SACKed skbs */
272272
struct sk_buff *highest_sack; /* skb just after the highest
273273
* skb with SACKed bit set
@@ -350,7 +350,6 @@ struct tcp_sock {
350350
u32 dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups
351351
* total number of DSACK blocks received
352352
*/
353-
u32 last_oow_ack_time; /* timestamp of last out-of-window ACK */
354353
u32 compressed_ack_rcv_nxt;
355354
struct list_head tsq_node; /* anchor in tsq_tasklet.head list */
356355

@@ -384,12 +383,12 @@ struct tcp_sock {
384383
syn_fastopen_ch:1, /* Active TFO re-enabling probe */
385384
syn_data_acked:1;/* data in SYN is acked by SYN-ACK */
386385

386+
u8 keepalive_probes; /* num of allowed keep alive probes */
387387
u32 tcp_tx_delay; /* delay (in usec) added to TX packets */
388388

389389
/* RTT measurement */
390390
u32 mdev_max_us; /* maximal mdev for the last rtt period */
391391

392-
u8 keepalive_probes; /* num of allowed keep alive probes */
393392
u32 reord_seen; /* number of data packet reordering events */
394393

395394
/*
@@ -402,6 +401,7 @@ struct tcp_sock {
402401
u32 prior_cwnd; /* cwnd right before starting loss recovery */
403402
u32 prr_delivered; /* Number of newly delivered packets to
404403
* receiver in Recovery. */
404+
u32 last_oow_ack_time; /* timestamp of last out-of-window ACK */
405405

406406
struct hrtimer pacing_timer;
407407
struct hrtimer compressed_ack_timer;
@@ -477,8 +477,8 @@ struct tcp_sock {
477477
bool is_mptcp;
478478
#endif
479479
#if IS_ENABLED(CONFIG_SMC)
480-
bool (*smc_hs_congested)(const struct sock *sk);
481480
bool syn_smc; /* SYN includes SMC */
481+
bool (*smc_hs_congested)(const struct sock *sk);
482482
#endif
483483

484484
#if defined(CONFIG_TCP_MD5SIG) || defined(CONFIG_TCP_AO)

0 commit comments

Comments
 (0)