Netdev List
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: "Björn Töpel" <bjorn@kernel.org>,
	"Usama Arif" <usama.arif@linux.dev>,
	michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
	kuba@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net,
	edumazet@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH] eth: bnxt: fix the agg page pool ring size on 64K-page kernels
Date: Thu, 3 Dec 2026 13:02:13 +0000	[thread overview]
Message-ID: <a21f2b4b-ae97-478a-81da-3f21161e0790@gmail.com> (raw)
In-Reply-To: <87zeuvkgv6.fsf@all.your.base.are.belong.to.us>

On 11/26/26 10:49, Björn Töpel wrote:
> Usama Arif <usama.arif@linux.dev> writes:
> 
>> Commit f7dbedba6312 ("eth: bnxt: take page size into account for page
>> pool recycling rings") sized the recycle ring of the agg page pool in
>> pages, dividing the agg ring size by PAGE_SIZE / BNXT_RX_PAGE_SIZE.
>> Commit c55bf90a2112 ("eth: bnxt: adjust the fill level of agg queues
>> with larger buffers") replaced PAGE_SIZE in that divisor with
>> rx_page_size.
>>
>> On 64K-page kernels rx_page_size can only be 32K, so the divisor is now
>> always 1. Each 64K page still holds two agg buffers and the page pool
>> recycles whole pages, so the recycle ring can cache twice as many pages
>> as the agg ring uses. With 1024 RX descriptors, the agg ring posts 2048
>> buffers in 1024 pages while the recycle ring holds up to 2048 pages, or
>> 128 MiB per RX queue.
>>
>> Divide by the larger of PAGE_SIZE and rx_page_size to restore the
>> original size. x86 with 4K base PAGE_SIZE and arm64 with 4K and 16K
>> PAGE_SIZE are unaffected, as rx_page_size is never smaller than PAGE_SIZE
>> there.
>>
>> The ring only fills up when the stack releases agg pages faster than
>> the driver reuses them. On a 64K arm64 host with a BCM57508 (32 queues,
>> 1024 RX descriptors), a TCP receiver that drained its sockets every
>> 1.5 s left about 1.8 GiB less memory cached after the fix, 64 MiB per
>> busy queue.
>>
>> Fixes: c55bf90a2112 ("eth: bnxt: adjust the fill level of agg queues with larger buffers")
>> Signed-off-by: Usama Arif <usama.arif@linux.dev>
>> ---
>>   drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> index 52606db3f7b4a8..ecc4848499c307 100644
>> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
>> @@ -3948,7 +3948,8 @@ static int bnxt_alloc_rx_page_pool(struct bnxt *bp,
>>   				   struct bnxt_rx_ring_info *rxr,
>>   				   int numa_node)
>>   {
>> -	unsigned int agg_size_fac = rxr->rx_page_size / BNXT_RX_PAGE_SIZE;
>> +	unsigned int agg_size_fac = max(PAGE_SIZE, rxr->rx_page_size) /
>> +				    BNXT_RX_PAGE_SIZE;
> 
> Hmm, shouldn't the denominator be rxr->rx_page_size rather than
> BNXT_RX_PAGE_SIZE?
> 
> bnxt_rx_agg_ring_fill_level() already accounts for larger RX buffers, so
> using the default buffer size here seems to account for the override
> twice.

Oh yes, and I have a suspicion I messed it up while rebasing.

> IIUC, the purpose of agg_size_fac is to convert the number of posted RX
> buffers into the number of recyclable backing allocations.
> 
> E.g. an iouring 16K override would result in a smaller (too small?)
> pool.

Fwiw, the normal zcrx buffer circulation doesn't use ring_ptr, so
we can even shrink it to save memory.

> This patch had me thinking; The default agg pool buffer size is 32K on
> 64K systems. That's quite a step up from the default 4K on 4K systems.
> 8x more RX buffer memory as an effect of using a system with larger
> pages... maybe there's a need for a system knob? That's pretty wasteful,
> unless the workload is really HWGRO friendly.
-- 
Pavel Begunkov


  parent reply	other threads:[~2026-12-03 13:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 16:29 [PATCH] eth: bnxt: fix the agg page pool ring size on 64K-page kernels Usama Arif
2026-11-26 10:49 ` Björn Töpel
2026-11-26 15:16   ` Usama Arif
2026-11-26 17:28     ` Björn Töpel
2026-12-03 13:02   ` Pavel Begunkov [this message]
2026-11-26 16:57 ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a21f2b4b-ae97-478a-81da-3f21161e0790@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bjorn@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=usama.arif@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox