aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2008-05-29 06:25:23 -0400
committerDavid S. Miller <davem@davemloft.net>2008-05-29 06:25:23 -0400
commitb79eeeb9e48457579cb742cd02e162fcd673c4a3 (patch)
treee804011ae95b5f21eb01732e4b0d768691cfd89d
parent75a9cd524c6bb441c61c85bae7020ce5e8b2e807 (diff)
tcp: Reorganize tcp_sock to fill 64-bit holes & improve locality
I tried to group recovery related fields nearby (non-CA_Open related variables, to be more accurate) so that one to three cachelines would not be necessary in CA_Open. These are now contiguously deployed: struct sk_buff_head out_of_order_queue; /* 1968 80 */ /* --- cacheline 32 boundary (2048 bytes) --- */ struct tcp_sack_block duplicate_sack[1]; /* 2048 8 */ struct tcp_sack_block selective_acks[4]; /* 2056 32 */ struct tcp_sack_block recv_sack_cache[4]; /* 2088 32 */ /* --- cacheline 33 boundary (2112 bytes) was 8 bytes ago --- */ struct sk_buff * highest_sack; /* 2120 8 */ int lost_cnt_hint; /* 2128 4 */ int retransmit_cnt_hint; /* 2132 4 */ u32 lost_retrans_low; /* 2136 4 */ u8 reordering; /* 2140 1 */ u8 keepalive_probes; /* 2141 1 */ /* XXX 2 bytes hole, try to pack */ u32 prior_ssthresh; /* 2144 4 */ u32 high_seq; /* 2148 4 */ u32 retrans_stamp; /* 2152 4 */ u32 undo_marker; /* 2156 4 */ int undo_retrans; /* 2160 4 */ u32 total_retrans; /* 2164 4 */ ...and they're then followed by URG slowpath & keepalive related variables. Head of the out_of_order_queue always needed for empty checks, if that's empty (and TCP is in CA_Open), following ~200 bytes (in 64-bit) shouldn't be necessary for anything. If only OFO queue exists but TCP is in CA_Open, selective_acks (and possibly duplicate_sack) are necessary besides the out_of_order_queue but the rest of the block again shouldn't be (ie., the other direction had losses). As the cacheline boundaries depend on many factors in the preceeding stuff, trying to align considering them doesn't make too much sense. Commented one ordering hazard. There are number of low utilized u8/16s that could be combined get 2 bytes less in total so that the hole could be made to vanish (includes at least ecn_flags, urg_data, urg_mode, frto_counter, nonagle). Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Acked-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/tcp.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 18e62e3d406f..9881295f3857 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -296,10 +296,9 @@ struct tcp_sock {
296 u32 rcv_ssthresh; /* Current window clamp */ 296 u32 rcv_ssthresh; /* Current window clamp */
297 297
298 u32 frto_highmark; /* snd_nxt when RTO occurred */ 298 u32 frto_highmark; /* snd_nxt when RTO occurred */
299 u8 reordering; /* Packet reordering metric. */ 299 u16 advmss; /* Advertised MSS */
300 u8 frto_counter; /* Number of new acks after RTO */ 300 u8 frto_counter; /* Number of new acks after RTO */
301 u8 nonagle; /* Disable Nagle algorithm? */ 301 u8 nonagle; /* Disable Nagle algorithm? */
302 u8 keepalive_probes; /* num of allowed keep alive probes */
303 302
304/* RTT measurement */ 303/* RTT measurement */
305 u32 srtt; /* smoothed round trip time << 3 */ 304 u32 srtt; /* smoothed round trip time << 3 */
@@ -310,6 +309,10 @@ struct tcp_sock {
310 309
311 u32 packets_out; /* Packets which are "in flight" */ 310 u32 packets_out; /* Packets which are "in flight" */
312 u32 retrans_out; /* Retransmitted packets out */ 311 u32 retrans_out; /* Retransmitted packets out */
312
313 u16 urg_data; /* Saved octet of OOB data and control flags */
314 u8 urg_mode; /* In urgent mode */
315 u8 ecn_flags; /* ECN status bits. */
313/* 316/*
314 * Options received (usually on last packet, some only on SYN packets). 317 * Options received (usually on last packet, some only on SYN packets).
315 */ 318 */
@@ -325,13 +328,24 @@ struct tcp_sock {
325 u32 snd_cwnd_used; 328 u32 snd_cwnd_used;
326 u32 snd_cwnd_stamp; 329 u32 snd_cwnd_stamp;
327 330
328 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
329
330 u32 rcv_wnd; /* Current receiver window */ 331 u32 rcv_wnd; /* Current receiver window */
331 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ 332 u32 write_seq; /* Tail(+1) of data held in tcp send buffer */
332 u32 pushed_seq; /* Last pushed seq, required to talk to windows */ 333 u32 pushed_seq; /* Last pushed seq, required to talk to windows */
334 u32 lost_out; /* Lost packets */
335 u32 sacked_out; /* SACK'd packets */
336 u32 fackets_out; /* FACK'd packets */
337 u32 tso_deferred;
338 u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
333 339
334/* SACKs data */ 340 /* from STCP, retrans queue hinting */
341 struct sk_buff* lost_skb_hint;
342 struct sk_buff *scoreboard_skb_hint;
343 struct sk_buff *retransmit_skb_hint;
344 struct sk_buff *forward_skb_hint;
345
346 struct sk_buff_head out_of_order_queue; /* Out of order segments go here */
347
348 /* SACKs data, these 2 need to be together (see tcp_build_and_update_options) */
335 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ 349 struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */
336 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ 350 struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/
337 351
@@ -342,23 +356,14 @@ struct tcp_sock {
342 * sacked_out > 0) 356 * sacked_out > 0)
343 */ 357 */
344 358
345 /* from STCP, retrans queue hinting */
346 struct sk_buff* lost_skb_hint;
347
348 struct sk_buff *scoreboard_skb_hint;
349 struct sk_buff *retransmit_skb_hint;
350 struct sk_buff *forward_skb_hint;
351
352 int lost_cnt_hint; 359 int lost_cnt_hint;
353 int retransmit_cnt_hint; 360 int retransmit_cnt_hint;
354 361
355 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */ 362 u32 lost_retrans_low; /* Sent seq after any rxmit (lowest) */
356 363
357 u16 advmss; /* Advertised MSS */ 364 u8 reordering; /* Packet reordering metric. */
365 u8 keepalive_probes; /* num of allowed keep alive probes */
358 u32 prior_ssthresh; /* ssthresh saved at recovery start */ 366 u32 prior_ssthresh; /* ssthresh saved at recovery start */
359 u32 lost_out; /* Lost packets */
360 u32 sacked_out; /* SACK'd packets */
361 u32 fackets_out; /* FACK'd packets */
362 u32 high_seq; /* snd_nxt at onset of congestion */ 367 u32 high_seq; /* snd_nxt at onset of congestion */
363 368
364 u32 retrans_stamp; /* Timestamp of the last retransmit, 369 u32 retrans_stamp; /* Timestamp of the last retransmit,
@@ -366,25 +371,18 @@ struct tcp_sock {
366 * the first SYN. */ 371 * the first SYN. */
367 u32 undo_marker; /* tracking retrans started here. */ 372 u32 undo_marker; /* tracking retrans started here. */
368 int undo_retrans; /* number of undoable retransmissions. */ 373 int undo_retrans; /* number of undoable retransmissions. */
374 u32 total_retrans; /* Total retransmits for entire connection */
375
369 u32 urg_seq; /* Seq of received urgent pointer */ 376 u32 urg_seq; /* Seq of received urgent pointer */
370 u16 urg_data; /* Saved octet of OOB data and control flags */
371 u8 urg_mode; /* In urgent mode */
372 u8 ecn_flags; /* ECN status bits. */
373 u32 snd_up; /* Urgent pointer */ 377 u32 snd_up; /* Urgent pointer */
374 378
375 u32 total_retrans; /* Total retransmits for entire connection */
376 u32 bytes_acked; /* Appropriate Byte Counting - RFC3465 */
377
378 unsigned int keepalive_time; /* time before keep alive takes place */ 379 unsigned int keepalive_time; /* time before keep alive takes place */
379 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 380 unsigned int keepalive_intvl; /* time interval between keep alive probes */
380 int linger2;
381 381
382 struct tcp_deferred_accept_info defer_tcp_accept; 382 struct tcp_deferred_accept_info defer_tcp_accept;
383 383
384 unsigned long last_synq_overflow; 384 unsigned long last_synq_overflow;
385 385
386 u32 tso_deferred;
387
388/* Receiver side RTT estimation */ 386/* Receiver side RTT estimation */
389 struct { 387 struct {
390 u32 rtt; 388 u32 rtt;
@@ -412,6 +410,8 @@ struct tcp_sock {
412/* TCP MD5 Signagure Option information */ 410/* TCP MD5 Signagure Option information */
413 struct tcp_md5sig_info *md5sig_info; 411 struct tcp_md5sig_info *md5sig_info;
414#endif 412#endif
413
414 int linger2;
415}; 415};
416 416
417static inline struct tcp_sock *tcp_sk(const struct sock *sk) 417static inline struct tcp_sock *tcp_sk(const struct sock *sk)