]> git.baikalelectronics.ru Git - kernel.git/commit
[TCP]: Keep copied_seq, rcv_wup and rcv_next together.
authorEric Dumazet <dada1@cosmosbay.com>
Thu, 22 Feb 2007 11:20:44 +0000 (03:20 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:23:21 +0000 (22:23 -0700)
commit9721cc77f459c9675a7b1fbef520b863187db3b9
tree44dedf7be5ac37fae65718d359ff598902247753
parent728b36171280f6b9e70a7cad2224021a37a38165
[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>
include/linux/tcp.h
net/ipv4/tcp_minisocks.c