From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Luigi Rizzo <lrizzo@google.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Luigi Rizzo <rizzo.unipi@gmail.com>,
Brian Vazquez <brianvv@google.com>,
Joshua Hay <joshua.a.hay@intel.com>,
Larysa Zaremba <larysa.zaremba@intel.com>,
"Jakub Kicinski" <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH iwl-next v3 0/2] libeth, idpf: use GFP_KERNEL for the initial Rx ring fill
Date: Tue, 10 Nov 2026 16:14:33 +0100 [thread overview]
Message-ID: <3d14c32a-62cc-40cb-bd60-2dc13b9a2e41@intel.com> (raw)
In-Reply-To: <CAMOZA0KTYjRGuD3axNKaNb-o5=c8Zt=zG4Q3JFxPbWuBVu5MKg@mail.gmail.com>
From: Luigi Rizzo <lrizzo@google.com>
Date: Mon, 9 Nov 2026 15:53:55 +0100
> On Thu, Nov 5, 2026 at 7:08 PM Alexander Lobakin
> <aleksander.lobakin@intel.com> wrote:
>>
>> From: Luigi Rizzo <lrizzo@google.com>
>> Date: Tue, 3 Nov 2026 16:23:23 +0000
>>
>>> libeth_rx_alloc() always allocates with GFP_ATOMIC, including when a
>>> driver fills its Rx rings at open or on queue reconfiguration. That
>>> fill runs in process context, right after page_pool_create() and before
>>> the queues' NAPI is enabled, so it may sleep, and GFP_ATOMIC is
>>> needlessly restrictive there: it can neither reclaim nor compact, while
>>> the initial fill can allocate tens of thousands of buffers across all
>>> queues.
>>>
>>> Patch 1 adds __libeth_rx_alloc() taking a gfp_t parameter and turns
>>> libeth_rx_alloc() into its GFP_ATOMIC wrapper.
>>> Patch 2 switches idpf's initial Rx ring fill (both splitq and singleq)
>>> to GFP_KERNEL.
>>>
>>> v3:
>>> - rename libeth_rx_alloc_gfp() to __libeth_rx_alloc() and put the gfp
>>> argument on its own line in page_pool_alloc_netmem() (Alexander Lobakin)
>>> v2: https://lore.kernel.org/r/20261019210604.2433620-1-lrizzo@google.com/
>>> - split into two patches (libeth helper and idpf consumer)
>>> v1: https://lore.kernel.org/r/20261016151835.2500807-1-lrizzo@google.com/
>>>
>>> Luigi Rizzo (2):
>>> libeth: add __libeth_rx_alloc() to specify allocation flags
>>> idpf: use GFP_KERNEL for the initial Rx ring fill
>>
>> For the series:
>>
>> Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
>
> Looking further at the problem, gemini pointed out that libeth_rx_alloc()
> is called in a way that makes it easy and robust to tell when it
> can use GFP_KERNEL. This would greatly simplify the patch.
>
> Alexander, do you like this version better perhaps ?
>
> cheers
> luigi
>
> diff --git a/include/net/libeth/rx.h b/include/net/libeth/rx.h
> index 5d991404845e6..38c0e5066f0ef 100644
> --- a/include/net/libeth/rx.h
> +++ b/include/net/libeth/rx.h
> @@ -104,10 +104,17 @@ void libeth_rx_fq_destroy(struct libeth_fq *fq);
> static inline dma_addr_t libeth_rx_alloc(const struct libeth_fq_fp *fq, u32 i)
> {
> struct libeth_fqe *buf = &fq->fqes[i];
> + /* fq->fqes is zero-allocated and pre-filled in process context for
> + * indices [0 .. fq->count - 2]; slot fq->count - 1 is first allocated
> + * in NAPI. Use GFP_KERNEL for initial pre-fill and GFP_ATOMIC after.
> + */
> + gfp_t gfp = (buf->truesize || i == fq->count - 1) ?
> + GFP_ATOMIC : GFP_KERNEL;
The fact that `fq->count - 1` is only allocated from the NAPI context is
idpf's detail that doesn't belong to libeth.
Even though this is way shorter diffstat than the original series, I
prefer the original as it doesn't change anything for drivers other than
idpf and allows specifying GFP flags manually without such guesses. This
change introduces new branches on hotpath for each driver that uses libeth.
>
> buf->truesize = fq->truesize;
> - buf->netmem = page_pool_dev_alloc_netmem(fq->pp, &buf->offset,
> - &buf->truesize);
> + buf->netmem = page_pool_alloc_netmem(fq->pp, &buf->offset,
> + &buf->truesize,
> + gfp | __GFP_NOWARN);
> if (unlikely(!buf->netmem))
> return DMA_MAPPING_ERROR;
Thanks,
Olek
prev parent reply other threads:[~2026-11-10 15:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 16:23 Luigi Rizzo
2026-11-03 16:23 ` [PATCH iwl-next v3 1/2] libeth: add __libeth_rx_alloc() to specify allocation flags Luigi Rizzo
2026-11-03 16:23 ` [PATCH iwl-next v3 2/2] idpf: use GFP_KERNEL for the initial Rx ring fill Luigi Rizzo
2026-11-05 18:08 ` [PATCH iwl-next v3 0/2] libeth, " Alexander Lobakin
2026-11-09 14:53 ` Luigi Rizzo
2026-11-10 15:14 ` Alexander Lobakin [this message]
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=3d14c32a-62cc-40cb-bd60-2dc13b9a2e41@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=brianvv@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrizzo@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=rizzo.unipi@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®