Re: [RFC net-next] net: page_pool: cap alloc cache size and refill by pool ring size

From: Jakub Kicinski

Date: Tue Feb 24 2026 - 18:40:17 EST


On Mon, 23 Feb 2026 11:24:10 +0200 Nimrod Oren wrote:
> I'd appreciate feedback on:
> * Whether this per-pool cache capping approach makes sense
> * If so, which option is preferable
> * Any alternative suggestions to better cap/scale the page_pool cache
> parameters for large pages

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.

#if PAGE_SIZE >= 64K
#define PP_ALLOC_CACHE_REFILL 16
#elif PAGE_SIZE >= 16K
#define PP_ALLOC_CACHE_REFILL 32
#else
#define PP_ALLOC_CACHE_REFILL 64
#endif

#define PP_ALLOC_CACHE_SIZE (PP_ALLOC_CACHE_REFILL * 2)