diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2007-02-22 06:20:44 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:23:21 -0400 |
commit | 54287cc178cf85dbae0decec8b4dc190bff757ad (patch) | |
tree | 44dedf7be5ac37fae65718d359ff598902247753 /include | |
parent | cf4c6bf83d0fa070f60b1ba8124dfe0e65fbfbcc (diff) |
[TCP]: Keep copied_seq, rcv_wup and rcv_next together.
I noticed in oprofile study a cache miss in tcp_rcv_established() to read
copied_seq.
ffffffff80400a80 <tcp_rcv_established>: /* tcp_rcv_established total: 4034293
2.0400 */
55493 0.0281 :ffffffff80400bc9: mov 0x4c8(%r12),%eax copied_seq
543103 0.2746 :ffffffff80400bd1: cmp 0x3e0(%r12),%eax rcv_nxt
if (tp->copied_seq == tp->rcv_nxt &&
len - tcp_header_len <= tp->ucopy.len) {
In this function, the cache line 0x4c0 -> 0x500 is used only for this
reading 'copied_seq' field.
rcv_wup and copied_seq should be next to rcv_nxt field, to lower number of
active cache lines in hot paths. (tcp_rcv_established(), tcp_poll(), ...)
As you suggested, I changed tcp_create_openreq_child() so that these fields
are changed together, to avoid adding a new store buffer stall.
Patch is 64bit friendly (no new hole because of alignment constraints)
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/tcp.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 29d3089038ab..415193e171e4 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -242,6 +242,8 @@ struct tcp_sock { | |||
242 | * See RFC793 and RFC1122. The RFC writes these in capitals. | 242 | * See RFC793 and RFC1122. The RFC writes these in capitals. |
243 | */ | 243 | */ |
244 | u32 rcv_nxt; /* What we want to receive next */ | 244 | u32 rcv_nxt; /* What we want to receive next */ |
245 | u32 copied_seq; /* Head of yet unread data */ | ||
246 | u32 rcv_wup; /* rcv_nxt on last window update sent */ | ||
245 | u32 snd_nxt; /* Next sequence we send */ | 247 | u32 snd_nxt; /* Next sequence we send */ |
246 | 248 | ||
247 | u32 snd_una; /* First byte we want an ack for */ | 249 | u32 snd_una; /* First byte we want an ack for */ |
@@ -307,10 +309,8 @@ struct tcp_sock { | |||
307 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | 309 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ |
308 | 310 | ||
309 | u32 rcv_wnd; /* Current receiver window */ | 311 | u32 rcv_wnd; /* Current receiver window */ |
310 | u32 rcv_wup; /* rcv_nxt on last window update sent */ | ||
311 | u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ | 312 | u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ |
312 | u32 pushed_seq; /* Last pushed seq, required to talk to windows */ | 313 | u32 pushed_seq; /* Last pushed seq, required to talk to windows */ |
313 | u32 copied_seq; /* Head of yet unread data */ | ||
314 | 314 | ||
315 | /* SACKs data */ | 315 | /* SACKs data */ |
316 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ | 316 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ |