Re: [RFC net-next] net: page_pool: cap alloc cache size and refill by pool ring size
From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-02-26 16:56:45
Also in:
lkml
From: Jakub Kicinski <kuba@kernel.org>
Date: 2026-02-26 16:56:45
Also in:
lkml
On Thu, 26 Feb 2026 17:28:55 +0200 Nimrod Oren wrote:
On 25/02/2026 1:39, Jakub Kicinski wrote:quoted
I'd simply change the defines based on PAGE_SIZE. The allocation batch size has nothing to do with the ring size, it's just amortizing allocations within a single NAPI cycle.Thanks, that sounds good to me. Do you think a formula like this would work? #define PP_ALLOC_CACHE_REFILL ((64 * SZ_4K) / PAGE_SIZE) #define PP_ALLOC_CACHE_SIZE (PP_ALLOC_CACHE_REFILL * 2) It keeps both values constant in bytes across page sizes, ensuring a consistent memory footprint for pool alloc-caches regardless of a system's page size.
I like the clarity / obviousness of the if/elif/else list. No need to think what the result would be for a given page size. But up to you.