mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: Gregory Price <gourry@gourry.net>, Lance Yang <lance.yang@linux.dev>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, akpm@linux-foundation.org,
	surenb@google.com, mhocko@suse.com, brendan.jackman@linux.dev,
	hannes@cmpxchg.org, ziy@nvidia.com, david@kernel.org,
	ljs@kernel.org, liam@infradead.org, rppt@kernel.org,
	baolin.wang@linux.alibaba.com, nico.pache@linux.dev,
	ryan.roberts@arm.com, dev.jain@arm.com, baohua@kernel.org,
	usama.arif@linux.dev, kas@kernel.org, matthew.brost@intel.com,
	joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com,
	ying.huang@linux.alibaba.com, apopple@nvidia.com
Subject: Re: [PATCH] mm/page_alloc: let the bulk and folio allocators carry alloc_flags
Date: Wed, 23 Sep 2026 08:32:29 +0200	[thread overview]
Message-ID: <80206444-d0c3-4dab-a5e3-a2909e58ea33@kernel.org> (raw)
In-Reply-To: <arMxm4ia5Md-Zt4R@gourry-fedora-PF4VCD3F>

On 9/23/26 03:59, Gregory Price wrote:
> On Tue, Sep 22, 2026 at 09:05:58PM +0800, Lance Yang wrote:
>> 
>> On Mon, Sep 14, 2026 at 11:51:14AM -0400, Gregory Price wrote:
>> >__alloc_pages_noprof() takes an explicit alloc_flags, but the bulk and
>> >folio entry points do not, so callers cannot select allocator behaviour
>> >(e.g. an alternate zonelist) through them.
>> >
>> >Thread alloc_flags through both, matching __alloc_pages_noprof(), and
>> >keep the flag-carrying primitives mm-internal (page_alloc.h) so the
>> >public gfp.h wrappers stay flag-free:
>> >
>> > - add __alloc_pages_bulk_noprof(gfp, ..., alloc_flags) in page_alloc.h
>> >   alloc_pages_bulk_noprof() becomes a wrapper passing ALLOC_DEFAULT
>> >
>> > - give __folio_alloc_noprof() an alloc_flags parameter and moves
>> >   __folio_alloc_node_noprof() moves into page_alloc.h
>> >   __folio_alloc_noprof() is no longer exported
>> >
>> >No functional change: every caller passes ALLOC_DEFAULT.
>> 
>> Yeah, but what if a caller passes ALLOC_NOLOCK in the future?
>> 
>> __alloc_pages_noprof() checks alloc_nolock_allowed() first, but
>> __alloc_pages_bulk_noprof() can enter its fast path without that check.
>> 
>> That fast path can reach _deferred_grow_zone() or pcp_spin_trylock().
>> Shouldn't we do the same check first?
>> 
>> Or am I missing something?
>> 
>> Cheers, Lance
> 
> There is some concern around NOLOCK here yes, in fact sashiko picked
> this issue up and I've been poking at it.

It's possible to document it as unsupported, add a VM_WARN_ON_ONCE etc.
It's not necessary for bulk alloc to support ALLOC_NOLOCK just because it
takes flags. e.g. kmalloc_nolock() supports a subset of gfp flags as well.

> I've actually been reworking this patch and pulled in changes from the
> ALLOC_UNMAPPED series to address this all at once.  I've been developing
> a page allocator unit-testing harness to help validate some assumptions
> before I post it.
> 
> ~Gregory


  reply	other threads:[~2026-09-23  6:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 15:51 Gregory Price
2026-09-14 16:54 ` Gregory Price
2026-09-22 13:05 ` Lance Yang
2026-09-23  1:59   ` Gregory Price
2026-09-23  6:32     ` Vlastimil Babka (SUSE) [this message]
2026-09-23 15:24       ` Gregory Price
2026-09-23 17:19         ` Vlastimil Babka (SUSE)

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=80206444-d0c3-4dab-a5e3-a2909e58ea33@kernel.org \
    --to=vbabka@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=brendan.jackman@linux.dev \
    --cc=byungchul@sk.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kas@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=matthew.brost@intel.com \
    --cc=mhocko@suse.com \
    --cc=nico.pache@linux.dev \
    --cc=rakie.kim@sk.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=surenb@google.com \
    --cc=usama.arif@linux.dev \
    --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

all inboxes | Powered by JetHome®