From: Christoph Paasch <christoph.paasch@uclouvain.be>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Yuchung Cheng <ycheng@google.com>,
Neal Cardwell <ncardwell@google.com>
Subject: Re: [PATCH v2 net-next 3/3] tcp: better TCP_SKB_CB layout to reduce cache line misses
Date: Thu, 25 Sep 2014 17:48:44 +0200 [thread overview]
Message-ID: <20140925154844.GM5044@cpaasch-mac> (raw)
In-Reply-To: <1411468452-3729-4-git-send-email-edumazet@google.com>
On 23/09/14 - 03:34:12, Eric Dumazet wrote:
> TCP maintains lists of skb in write queue, and in receive queues
> (in order and out of order queues)
>
> Scanning these lists both in input and output path usually requires
> access to skb->next, TCP_SKB_CB(skb)->seq, and TCP_SKB_CB(skb)->end_seq
>
> These fields are currently in two different cache lines, meaning we
> waste lot of memory bandwidth when these queues are big and flows
> have either packet drops or packet reorders.
>
> We can move TCP_SKB_CB(skb)->header at the end of TCP_SKB_CB, because
> this header is not used in fast path. This allows TCP to search much faster
> in the skb lists.
>
> Even with regular flows, we save one cache line miss in fast path.
>
> Thanks to Christoph Paasch for noticing we need to cleanup
> skb->cb[] (IPCB/IP6CB) before entering IP stack in tx path.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
> include/net/tcp.h | 12 ++++++------
> net/ipv4/tcp_ipv4.c | 7 +++++++
> net/ipv4/tcp_output.c | 5 +++++
> net/ipv6/tcp_ipv6.c | 7 +++++++
> 4 files changed, 25 insertions(+), 6 deletions(-)
Hello Eric,
I think that in tcp_v4_hnd_req() and tcp_v4_save_options() we also need to
avoid calling IPCB() and do TCP_SKB_CB(skb)->header.h4.opt instead.
Cheers,
Christoph
next prev parent reply other threads:[~2014-09-25 15:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 10:34 [PATCH v2 net-next 0/3] tcp: better TCP_SKB_CB layout Eric Dumazet
2014-09-23 10:34 ` [PATCH v2 net-next 1/3] ipv4: rename ip_options_echo to __ip_options_echo() Eric Dumazet
2014-09-23 10:34 ` [PATCH v2 net-next 2/3] ipv6: add a struct inet6_skb_parm param to ipv6_opt_accepted() Eric Dumazet
2014-09-23 10:34 ` [PATCH v2 net-next 3/3] tcp: better TCP_SKB_CB layout to reduce cache line misses Eric Dumazet
2014-09-25 15:48 ` Christoph Paasch [this message]
2014-09-25 18:36 ` Eric Dumazet
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=20140925154844.GM5044@cpaasch-mac \
--to=christoph.paasch@uclouvain.be \
--cc=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