From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev <netdev@vger.kernel.org>
Subject: [RFC] fclone layout suboptimal
Date: Fri, 26 Sep 2014 06:07:39 -0700 [thread overview]
Message-ID: <1411736859.16953.121.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
Fast clones have following layout :
[sk_buff 1]
[sk_buff 2]
[atomic_t fclone_ref]
Main consumer is TCP stack for its write queue.
When tcp_ack()/tcp_clean_rtx_queue() frees skb,
kfree_skbmem() needs to fetch a cold cache line :
0.72 │ je b0
│6f: add $0x8,%rsp
│ pop %rbx
0.07 │ pop %rbp
│ retq
│ nop
0.52 │80: lock decl 0x1b0(%rbx)
90.23 │ ┌──je 90
│ │ jmp 6f
│ │ nop
│90:└─ mov 0x5c4e29(%rip),%rdi
│ mov %rbx,%rsi
│ callq kmem_cache_free
1.37 │ add $0x8,%rsp
│ pop %rbx
│ pop %rbp
0.91 │ retq
│ nop
│b0: mov 0x5c4e09(%rip),%rdi
│ lea -0xd8(%rbx),%rsi
│ callq kmem_cache_free
It might be better to have :
[sk_buff skb1]
[atomic_t fclone_ref]
[sk_buff skb2]
__alloc(skb) would not have to dirty a cache line to perform the
atomic_set(fclone_ref, 1);
kfree_skbmem() would do the atomic_dec_and_test() on a hot cache line
(Because we had access to skb_shinfo() a bit earlier while doing
skb_release_all()
When TX completions has to free the cloned sk_buff, fetching fclone_ref
would use an already hot cache line as well (skb2->next / skb2->sk are
already in cpu cache)
next reply other threads:[~2014-09-26 13:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-26 13:07 Eric Dumazet [this message]
2014-09-26 13:35 ` [RFC] fclone layout suboptimal 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=1411736859.16953.121.camel@edumazet-glaptop2.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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