netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net-next 0/3] tcp: no longer keep around headers in input path
@ 2014-09-15 11:19 Eric Dumazet
  2014-09-15 11:19 ` [PATCH v2 net-next 1/3] tcp: use TCP_SKB_CB(skb)->tcp_flags " Eric Dumazet
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Eric Dumazet @ 2014-09-15 11:19 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Yuchung Cheng, Neal Cardwell, Eric Dumazet

Looking at tcp_try_coalesce() I was wondering why I did :

if (tcp_hdr(from)->fin)
     return false;

The answer would be to allow the aggregation, if we simply OR the FIN and PSH
flags eventually present in @from to @to packet. (Note a change is also
needed in skb_try_coalesce() to avoid calling skb_put() with 0 len)

Then, looking at tcp_recvmsg(), I realized we access tcp_hdr(skb)->syn
(and maybe tcp_hdr(skb)->fin) for every packet we process from socket
receive queue.

We have to understand TCP flags are cold in cpu caches most of the time
(assuming TCP timestamps, and that application calls recvmsg() a long
time after incoming packet was processed), and bringing a whole
cache line only to access one bit is not very nice.

It would make sense to use in TCP input path TCP_SKB_CB(skb)->tcp_flags
as we do in output path.

This saves one cache line miss, and TCP tcp_collapse() can avoid dealing
with the headers.


Eric Dumazet (3):
  tcp: use TCP_SKB_CB(skb)->tcp_flags in input path
  tcp: allow segment with FIN in tcp_try_coalesce()
  tcp: do not copy headers in tcp_collapse()

 net/core/skbuff.c    |  3 ++-
 net/ipv4/tcp.c       | 18 ++++++++++--------
 net/ipv4/tcp_input.c | 31 ++++++++-----------------------
 net/ipv4/tcp_ipv4.c  |  1 +
 net/ipv6/tcp_ipv6.c  |  1 +
 5 files changed, 22 insertions(+), 32 deletions(-)

-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-09-15 18:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-15 11:19 [PATCH v2 net-next 0/3] tcp: no longer keep around headers in input path Eric Dumazet
2014-09-15 11:19 ` [PATCH v2 net-next 1/3] tcp: use TCP_SKB_CB(skb)->tcp_flags " Eric Dumazet
2014-09-15 16:13   ` Neal Cardwell
2014-09-15 11:19 ` [PATCH v2 net-next 2/3] tcp: allow segment with FIN in tcp_try_coalesce() Eric Dumazet
2014-09-15 16:20   ` Neal Cardwell
2014-09-15 11:19 ` [PATCH v2 net-next 3/3] tcp: do not copy headers in tcp_collapse() Eric Dumazet
2014-09-15 16:29   ` Neal Cardwell
2014-09-15 18:41 ` [PATCH v2 net-next 0/3] tcp: no longer keep around headers in input path David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).