Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

eth: bnxt: take page size into account for page pool recycling rings

The Rx rings are filled with Rx buffers. Which are supposed to fit
packet headers (or MTU if HW-GRO is disabled). The aggregation buffers
are filled with "device pages". Adjust the sizes of the page pool
recycling ring appropriately, based on ratio of the size of the
buffer on given ring vs system page size. Otherwise on a system
with 64kB pages we end up with >700MB of memory sitting in every
single page pool cache.

Correct the size calculation for the head_pool. Since the buffers
there are always small I'm pretty sure I meant to cap the size
at 1k, rather than make it the lowest possible size. With 64k pages
1k cache with a 1k ring is 64x larger than we need.

Reviewed-by: Michael Chan <michael.chan@broadcom.com>
Link: https://patch.msgid.link/20250626165441.4125047-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+5 -3
+5 -3
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 3810 3810 struct bnxt_rx_ring_info *rxr, 3811 3811 int numa_node) 3812 3812 { 3813 + const unsigned int agg_size_fac = PAGE_SIZE / BNXT_RX_PAGE_SIZE; 3814 + const unsigned int rx_size_fac = PAGE_SIZE / SZ_4K; 3813 3815 struct page_pool_params pp = { 0 }; 3814 3816 struct page_pool *pool; 3815 3817 3816 - pp.pool_size = bp->rx_agg_ring_size; 3818 + pp.pool_size = bp->rx_agg_ring_size / agg_size_fac; 3817 3819 if (BNXT_RX_PAGE_MODE(bp)) 3818 - pp.pool_size += bp->rx_ring_size; 3820 + pp.pool_size += bp->rx_ring_size / rx_size_fac; 3819 3821 pp.nid = numa_node; 3820 3822 pp.napi = &rxr->bnapi->napi; 3821 3823 pp.netdev = bp->dev; ··· 3835 3833 3836 3834 rxr->need_head_pool = page_pool_is_unreadable(pool); 3837 3835 if (bnxt_separate_head_pool(rxr)) { 3838 - pp.pool_size = max(bp->rx_ring_size, 1024); 3836 + pp.pool_size = min(bp->rx_ring_size / rx_size_fac, 1024); 3839 3837 pp.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV; 3840 3838 pool = page_pool_create(&pp); 3841 3839 if (IS_ERR(pool))