[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d8dce1ae33860437c55c56ffa9718cb1d1523bad.camel@gmail.com>
Date: Wed, 28 Sep 2022 07:24:14 -0700
From: Alexander H Duyck <alexander.duyck@...il.com>
To: Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Alexander H Duyck <alexanderduyck@...com>
Subject: Re: [PATCH net-next v4] net: skb: introduce and use a single page
frag cache
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@...il.com>
> Suggested-by: Alexander H Duyck <alexanderduyck@...com>
> Signed-off-by: Paolo Abeni <pabeni@...hat.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@...com>
Powered by blists - more mailing lists