Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Brendan Jackman <brendan.jackman@linux.dev>,
	Matthew Wilcox <willy@infradead.org>,
	Brendan Jackman <jackmanb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	Mike Rapoport <rppt@kernel.org>,
	Matthew Brost <matthew.brost@intel.com>,
	Joshua Hahn <joshua.hahnjy@gmail.com>,
	Rakie Kim <rakie.kim@sk.com>, Byungchul Park <byungchul@sk.com>,
	Ying Huang <ying.huang@linux.alibaba.com>,
	Alistair Popple <apopple@nvidia.com>, Hao Li <hao.li@linux.dev>,
	Christoph Lameter <cl@gentwo.org>,
	David Rientjes <rientjes@google.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Clark Williams <clrkwllms@kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	"Harry Yoo (Oracle)" <harry@kernel.org>,
	Gregory Price <gourry@gourry.net>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-rt-devel@lists.linux.dev
Subject: Re: [PATCH] mm/page_alloc: unify __alloc_frozen_pages[_nolock]_noprof()
Date: Mon, 22 Jun 2026 10:24:13 +0200	[thread overview]
Message-ID: <0eeb0dd3-92e8-4841-b250-e77540da0693@kernel.org> (raw)
In-Reply-To: <DJCVLX0WK118.3V7CXOTLISFOQ@linux.dev>

On 6/19/26 10:17, Brendan Jackman wrote:
> On Fri Jun 19, 2026 at 3:56 AM UTC, Matthew Wilcox wrote:
>>> +/*
>>> + * This is the 'heart' of the zoned buddy allocator.
>>> + */
>>> +struct page *__alloc_frozen_pages_noprof(gfp_t gfp, unsigned int order,
>>> +		int preferred_nid, nodemask_t *nodemask, unsigned int alloc_flags)
>>> +{
>>> +	struct page *page;
>>> +	gfp_t alloc_gfp; /* The gfp_t that was actually used for allocation */
>>> +	struct alloc_context ac = { };
>>> +
>>> +	/* Other flags could be supported later if needed. */
>>> +	if (WARN_ON(alloc_flags & ~ALLOC_TRYLOCK))
>>>  		return NULL;
>>>  
>>> +	if (!alloc_order_allowed(gfp, order, alloc_flags))
>>> +		return NULL;
>>> +
>>> +	if (alloc_flags & ALLOC_TRYLOCK) {
>>> +		VM_WARN_ON_ONCE(gfp & ~__GFP_ACCOUNT);
>>
>> So the only GFP flag the user is allowed to specify is __GFP_ACCOUNT?
>> That seems bogus; other flags would be reasonable including all the ones
>> in gfp_trylock, as well as GFP_HIGHMEM, GFP_DMA, GFP_MOVABLE, GFP_HARDWALL.

We could start phasing out GFP_HIGHMEM and GFP_DMA somewhere :)

> Definitely makes sense for the ones in gfp_trylock.
> 
> For the others, I'm not sure - this "nolock" functionality is a bit
> weird and sketchy, I suspect the reason for the WARN here is "let's make
> sure we have a proper think before we allow it to grow usecases that are

Yeah you were just keeping the same allowed flags that
alloc_frozen_pages_nolock_noprof() currently does.

> meaningfully different from the other ones". I think I like that
> conservatism here, I would lean towards keeping it? Not a passionately
> held opinion though.

Yeah if we expand it, I'd do it separately and in response to use cases
appearing.
We want _nolock to be used only where really necessary, as its success is
very limited, not to be (ab)used as a cheap way out of a wrongly designed
driver or something. ("oh I need to allocate something here and can't spin,
so let's just use this, solved").


      parent reply	other threads:[~2026-06-22  8:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 15:29 [PATCH] mm/page_alloc: unify __alloc_frozen_pages[_nolock]_noprof() Brendan Jackman
2026-06-17 16:39 ` Vlastimil Babka (SUSE)
2026-06-17 16:49   ` Suren Baghdasaryan
2026-06-17 17:14     ` Brendan Jackman
2026-06-18  2:22       ` Hao Ge
2026-06-19 11:57         ` Brendan Jackman
2026-06-19 18:08           ` Suren Baghdasaryan
2026-06-22  1:58             ` Hao Ge
2026-06-22  8:33               ` Brendan Jackman
2026-06-18  6:56 ` Hao Ge
2026-06-19  8:03   ` Brendan Jackman
2026-06-19  3:56 ` Matthew Wilcox
2026-06-19  8:17   ` Brendan Jackman
2026-06-19  8:43     ` Brendan Jackman
2026-06-22  8:24     ` Vlastimil Babka (SUSE) [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=0eeb0dd3-92e8-4841-b250-e77540da0693@kernel.org \
    --to=vbabka@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=bigeasy@linutronix.de \
    --cc=brendan.jackman@linux.dev \
    --cc=byungchul@sk.com \
    --cc=cl@gentwo.org \
    --cc=clrkwllms@kernel.org \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=hao.li@linux.dev \
    --cc=harry@kernel.org \
    --cc=jackmanb@google.com \
    --cc=joshua.hahnjy@gmail.com \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=ljs@kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=rakie.kim@sk.com \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ziy@nvidia.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