From: Jesper Dangaard Brouer <hawk@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>, davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org,
ilias.apalodimas@linaro.org, nathan@kernel.org,
nick.desaulniers+lkml@gmail.com, morbo@google.com,
justinstitt@google.com, llvm@lists.linux.dev,
Linux-MM <linux-mm@kvack.org>
Subject: Re: [PATCH net-next] page_pool: always add GFP_NOWARN for ATOMIC allocations
Date: Thu, 11 Sep 2025 15:05:14 +0200 [thread overview]
Message-ID: <7ea8e560-89f6-4f3a-97a6-cf70c1d3d0d0@kernel.org> (raw)
In-Reply-To: <20250910175240.72c56e86@kernel.org>
On 11/09/2025 02.52, Jakub Kicinski wrote:
> On Mon, 8 Sep 2025 08:21:23 -0700 Jakub Kicinski wrote:
>> Driver authors often forget to add GFP_NOWARN for page allocation
>> from the datapath. This is annoying to operators as OOMs are a fact
>> of life, and we pretty much expect network Rx to hit page allocation
>> failures during OOM. Make page pool add GFP_NOWARN for ATOMIC allocations
>> by default.
>
> Hi Jesper! Are you okay with this? [2] It's not a lot of instructions and
> it's in the _slow() function, anyway.
For this "_slow()" function I don't worry about the performance.
The optimization you did seems a bit premature... did you run the
page_pool benchmark to see if it is worth it?
> TBH I wrote the patch to fix the
> driver (again) first but when writing the commit message I realized my
> explanation why we can't fix this in the core was sounding like BS :$
It feels slightly strange to fix drivers misuse of the API in the core,
but again I'm not going to nack it, as it might be easier for us as
maintainers as it is hard to catch all cases during driver review.
All driver are suppose to use page_pool_dev_alloc[1] as it sets
(GFP_ATOMIC | __GFP_NOWARN). Or page_pool_dev_alloc_netmems().
[1] https://elixir.bootlin.com/linux/v6.16.6/source/include/net/
page_pool/helpers.h#L175-L179
The reason I added page_pool_dev_alloc() is because all driver used to
call a function named dev_alloc_page(), that also sets the appropriate
GFP flags. So, I simple piggybacked on that design decision (which I
don't know whom came up with). Thus, I'm open to change. Maybe DaveM
can remember/explain why "dev_alloc" was a requirement.
I'll let it be up to you,
--Jesper
[2] https://lore.kernel.org/all/20250908152123.97829-1-kuba@kernel.org/
parent reply other threads:[~2025-09-11 13:05 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20250910175240.72c56e86@kernel.org>]
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=7ea8e560-89f6-4f3a-97a6-cf70c1d3d0d0@kernel.org \
--to=hawk@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=justinstitt@google.com \
--cc=kuba@kernel.org \
--cc=linux-mm@kvack.org \
--cc=llvm@lists.linux.dev \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nick.desaulniers+lkml@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox