From: Alexander H Duyck <alexander.duyck@gmail.com>
To: Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Alexander H Duyck <alexanderduyck@fb.com>
Subject: Re: [PATCH net-next v4] net: skb: introduce and use a single page frag cache
Date: Wed, 28 Sep 2022 07:24:14 -0700 [thread overview]
Message-ID: <d8dce1ae33860437c55c56ffa9718cb1d1523bad.camel@gmail.com> (raw)
In-Reply-To: <6b6f65957c59f86a353fc09a5127e83a32ab5999.1664350652.git.pabeni@redhat.com>
On Wed, 2022-09-28 at 10:43 +0200, Paolo Abeni wrote:
> After commit 3226b158e67c ("net: avoid 32 x truesize under-estimation
> for tiny skbs") we are observing 10-20% regressions in performance
> tests with small packets. The perf trace points to high pressure on
> the slab allocator.
>
> This change tries to improve the allocation schema for small packets
> using an idea originally suggested by Eric: a new per CPU page frag is
> introduced and used in __napi_alloc_skb to cope with small allocation
> requests.
>
> To ensure that the above does not lead to excessive truesize
> underestimation, the frag size for small allocation is inflated to 1K
> and all the above is restricted to build with 4K page size.
>
> Note that we need to update accordingly the run-time check introduced
> with commit fd9ea57f4e95 ("net: add napi_get_frags_check() helper").
>
> Alex suggested a smart page refcount schema to reduce the number
> of atomic operations and deal properly with pfmemalloc pages.
>
> Under small packet UDP flood, I measure a 15% peak tput increases.
>
> Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
> Suggested-by: Alexander H Duyck <alexanderduyck@fb.com>
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> ---
> v3 -> v4:
> - NAPI_HAS_SMALL_PAGE <-> 4K page (Eric)
> - fixed typos in comments (Eric)
>
> v2 -> v3:
> - updated Alex email address
> - fixed build with !NAPI_HAS_SMALL_PAGE_FRAG
>
> v1 -> v2:
> - better page_frag_alloc_1k() (Alex & Eric)
> - avoid duplicate code and gfp_flags misuse in __napi_alloc_skb() (Alex)
> ---
Looks good to me.
Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
next prev parent reply other threads:[~2022-09-28 14:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-28 8:43 [PATCH net-next v4] net: skb: introduce and use a single page frag cache Paolo Abeni
2022-09-28 14:11 ` Eric Dumazet
2022-09-28 14:24 ` Alexander H Duyck [this message]
2022-09-30 2:21 ` patchwork-bot+netdevbpf
2022-09-30 16:43 ` Eric Dumazet
2022-09-30 17:30 ` Paolo Abeni
2022-09-30 17:45 ` Eric Dumazet
2022-10-02 14:55 ` Paolo Abeni
2022-10-03 21:40 ` Paolo Abeni
2022-10-03 22:30 ` Eric Dumazet
2022-10-05 7:33 ` Paolo Abeni
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=d8dce1ae33860437c55c56ffa9718cb1d1523bad.camel@gmail.com \
--to=alexander.duyck@gmail.com \
--cc=alexanderduyck@fb.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).