Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory Price <gourry@gourry.net>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: linux-mm@kvack.org, willy@infradead.org, vbabka@kernel.org,
	 brendan.jackman@linux.dev, linux-kernel@vger.kernel.org,
	linux-fsdevel@vger.kernel.org,  kernel-team@meta.com,
	jack@suse.cz, akpm@linux-foundation.org, ziy@nvidia.com,
	 joshua.hahnjy@gmail.com, rakie.kim@sk.com,
	ying.huang@linux.alibaba.com,  surenb@google.com,
	mhocko@suse.com, hannes@cmpxchg.org
Subject: Re: [RFC PATCH 0/6] mm: pass alloc_flags through folio, filemap, and bulk allocators
Date: Fri, 9 Oct 2026 19:28:52 -0400	[thread overview]
Message-ID: <asloWFM96BATH8SB@gourry-fedora-PF4VCD3F> (raw)
In-Reply-To: <df588805-6f97-4ef6-a64f-39222669bf3a@kernel.org>

On Fri, Oct 09, 2026 at 10:55:05PM +0200, David Hildenbrand (Arm) wrote:
> I do agree that two sets of flags is suboptimal, but likely more flexible. I
> guess an alloc_flags only interface is not easily possible ...
> 
> I do wonder whether it should be:
> 
> 	typedef int __bitwise alloc_flags_t;
> 
> instead of "unsigned int alloc_flags".
> 
> ... while at it

Does it make sense to leave alloc_flags to internal-only state
and just implement a new flag field?

gfp_t       -> describe the page (fully public)
req_t       -> describe the allocator behavior (mm-internal only)
alloc_flags -> internal allocator state only

typedef int __bitwise pa_req_t; /* Page Allocator Request Flags */

#define PA_REQ_DEFAULT        0
#define PA_REQ_NOLOCK         BIT(0) /* from ALLOC_NOLOCK */
#define PA_REQ_NO_CODETAG     BIT(1) /* from ALLOC_NO_CODETAG */
#define PA_REQ_SPREAD_DIRTY   BIT(2) /* from __GFP_WRITE */
#define PA_REQ_DEFER_INIT     BIT(3) /* from __GFP_SKIP_ZERO */
#define PA_REQ_ZERO_TAGS      BIT(4) /* from __GFP_ZERO_TAGS */
#define PA_REQ_NO_FALLBACK    BIT(5) /* select no fallback list */
#define PA_REQ_NO_OOM         BIT(6) /* do not oom */

Off the bat we recover 2 ALLOC flags and 3 GFP flags. Possibly more with
a bit more work.

Then we get:

#define PA_REQ_PRIVATE        BIT(7) /* allow private node allocation */
#define PA_REQ_UNMAPPED       BIT(8) /* page must be unmapped */

And we might not even need a new zonelist for private nodes in this case
as long as we require internal users to pass PA_REQ_PRIVATE and add a
function like

folio_alloc_private(void *owner, ...) {
   /* validate (pgdat->owner == owner) before allowing allocation */
   __folio_alloc(..., req | PA_REQ_PRIVATE | PA_REQ_NOFALLBACK, ...);
}

User still has the option to request NO_OOM via __GFP_THISNODE :]

~Gregory


      reply	other threads:[~2026-10-09 23:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 21:10 [RFC PATCH 0/6] mm: pass alloc_flags through folio, filemap, and bulk allocators Gregory Price
2026-09-23 21:10 ` [RFC PATCH 1/6] mm/page_alloc: clarify bulk allocator flag scope Gregory Price
2026-09-23 21:10 ` [RFC PATCH 2/6] mm/page_alloc: refactor alloc_flags preparation Gregory Price
2026-09-23 21:10 ` [RFC PATCH 3/6] mm/page_alloc: add an alloc_flags-aware folio allocator Gregory Price
2026-09-23 21:10 ` [RFC PATCH 4/6] mm/mempolicy: plumb alloc_flags through folio allocation Gregory Price
2026-09-23 21:10 ` [RFC PATCH 5/6] mm/filemap: " Gregory Price
2026-09-23 21:10 ` [RFC PATCH 6/6] mm/page_alloc: let the bulk allocator carry alloc_flags Gregory Price
2026-09-23 21:42 ` [RFC PATCH 0/6] mm: pass alloc_flags through folio, filemap, and bulk allocators Matthew Wilcox
2026-09-23 22:09   ` Gregory Price
2026-10-08  9:10 ` Gregory Price
2026-10-09 20:55   ` David Hildenbrand (Arm)
2026-10-09 23:28     ` Gregory Price [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=asloWFM96BATH8SB@gourry-fedora-PF4VCD3F \
    --to=gourry@gourry.net \
    --cc=akpm@linux-foundation.org \
    --cc=brendan.jackman@linux.dev \
    --cc=david@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kernel-team@meta.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=rakie.kim@sk.com \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --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