netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: edumazet@google.com
Cc: netdev@vger.kernel.org, ycheng@google.com, ncardwell@google.com
Subject: Re: [PATCH v2 net-next 0/3] tcp: no longer keep around headers in input path
Date: Mon, 15 Sep 2014 14:41:37 -0400 (EDT)	[thread overview]
Message-ID: <20140915.144137.278293056053518622.davem@davemloft.net> (raw)
In-Reply-To: <1410779993-31464-1-git-send-email-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Mon, 15 Sep 2014 04:19:50 -0700

> 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.

Looks great, applied, thanks Eric.

      parent reply	other threads:[~2014-09-15 18:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` David Miller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140915.144137.278293056053518622.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=ycheng@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).