[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACKFLin2y=Y1s3ge8kfdi-qHGfoQr9S3BwOUCSKTCu6q8Y6D1Q@mail.gmail.com>
Date: Thu, 26 Jun 2025 14:52:17 -0700
From: Michael Chan <michael.chan@...adcom.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
pabeni@...hat.com, andrew+netdev@...n.ch, horms@...nel.org,
pavan.chebbi@...adcom.com
Subject: Re: [PATCH net-next] eth: bnxt: take page size into account for page
pool recycling rings
On Thu, Jun 26, 2025 at 9:54 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> 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.
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> CC: michael.chan@...adcom.com
> CC: pavan.chebbi@...adcom.com
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index c5026fa7e6e6..1c6a3ebcda16 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -3807,12 +3807,14 @@ static int bnxt_alloc_rx_page_pool(struct bnxt *bp,
> struct bnxt_rx_ring_info *rxr,
> int numa_node)
> {
> + const unsigned int agg_size_fac = PAGE_SIZE / BNXT_RX_PAGE_SIZE;
> + const unsigned int rx_size_fac = PAGE_SIZE / SZ_4K;
> struct page_pool_params pp = { 0 };
> struct page_pool *pool;
>
> - pp.pool_size = bp->rx_agg_ring_size;
> + pp.pool_size = bp->rx_agg_ring_size / agg_size_fac;
The bp->rx_agg_ring_size has already taken the system PAGE_SIZE into
consideration to some extent in bnxt_set_ring_params(). The
jumbo_factor and agg_factor will be smaller when PAGE_SIZE is larger.
Will this overcompensate?
Download attachment "smime.p7s" of type "application/pkcs7-signature" (4196 bytes)
Powered by blists - more mailing lists