From: Simon Horman <horms@kernel.org>
To: Nicolai Buchwitz <nb@tipi-net.de>
Cc: Doug Berger <opendmb@gmail.com>,
Florian Fainelli <florian.fainelli@broadcom.com>,
Broadcom internal kernel review list
<bcm-kernel-feedback-list@broadcom.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Justin Chen <justin.chen@broadcom.com>,
kmehltretter@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: bcmgenet: allocate RX buffers as page fragments
Date: Fri, 25 Sep 2026 17:57:32 +0100 [thread overview]
Message-ID: <20260925165732.GR13925@horms.kernel.org> (raw)
In-Reply-To: <890feb51a8204e6e9f486bcee8e4f819@tipi-net.de>
On Fri, Sep 25, 2026 at 03:59:57PM +0200, Nicolai Buchwitz wrote:
> Hi Simon
>
> On 25.9.2026 15:47, Simon Horman wrote:
> > On Thu, Sep 24, 2026 at 12:19:21PM +0200, Nicolai Buchwitz wrote:
> > > Since the page_pool conversion every RX buffer is a whole page and the
> > > skb truesize is the page, although the hardware writes at most 2 KiB
> > > of
> > > it. On 64 KiB pages a packet therefore counts 65792 bytes against the
> > > socket buffer where it used to count 2752. As a result a UDP socket
> > > with the default buffer starts to drop after three packets, and the RX
> > > rings pin 16 MiB for 512 KiB of buffers.
> > >
> > > Fix this and allocate the buffers as page fragments, so the truesize
> > > is
> > > what a packet occupies. 4 KiB pages stay one buffer per page.
> > >
> > > Sync each buffer in the refill path, as page_pool can only sync a
> > > whole
> > > page on recycle. On 4 KiB pages that is twice what the hardware wrote.
> > >
> > > Fixes: 7bc054c2d4ed ("net: bcmgenet: convert RX path to page_pool")
> > > Reported-by: Karl Mehltretter <kmehltretter@gmail.com>
> > > Closes: https://lore.kernel.org/all/20260924065839.56793-1-kmehltretter@gmail.com/
> > > Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
> >
> > ...
> >
> > > @@ -2254,11 +2257,12 @@ static int bcmgenet_rx_refill(struct
> > > bcmgenet_rx_ring *ring,
> > > struct enet_cb *cb)
> > > {
> > > struct bcmgenet_priv *priv = ring->priv;
> > > + unsigned int size = GENET_RX_BUF_SIZE;
> > > + unsigned int offset;
> > > dma_addr_t mapping;
> > > struct page *page;
> > >
> > > - page = page_pool_alloc_pages(ring->page_pool,
> > > - GFP_ATOMIC);
> > > + page = page_pool_dev_alloc(ring->page_pool, &offset, &size);
> >
> > I think it is not so important either way, but I'm wondering
> > if you considered using page_pool_alloc_frag() here.
>
> Yes, I did, but page_pool_alloc() seemed a better fit as it hands back
> the usable size in *size. Also it falls back to a whole page above half a
> page and avoids an underestimate at the end of a page.
Thanks for the clarification.
All looks good to me.
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2026-09-25 16:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 10:19 [PATCH net] net: bcmgenet: allocate RX buffers as page fragments Nicolai Buchwitz
2026-09-25 13:47 ` Simon Horman
2026-09-25 13:59 ` Nicolai Buchwitz
2026-09-25 16:57 ` Simon Horman [this message]
2026-09-25 17:11 ` Karl Mehltretter
2026-09-26 0:40 ` patchwork-bot+netdevbpf
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=20260925165732.GR13925@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=justin.chen@broadcom.com \
--cc=kmehltretter@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.