Re: [PATCH v3 03/26] mm: introduce AS_NO_DIRECT_MAP

From: Gregory Price

Date: Tue Sep 15 2026 - 13:06:48 EST


On Thu, Sep 03, 2026 at 07:06:02AM -0700, Yosry Ahmed wrote:
> > As far as I know, Brendan is no longer at Google. I do not know whether
> > he plans to continue the ALLOC_UNMAPPED / mermap work, or whether someone
> > else at Google has taken it over.
>
> I am currently working on a new version of the ALLOC_UNMAPPED series,
> I am hoping to send something out soon.
>

Hi Yosry,

I've been trying to pull just the alloc_flags extensions (bulk and folio
allocator API extensions) out of this set and my private-node work.

I was taking another browse to make sure I didn't miss anything.
I just saw this, and noticed i should have probably been cc'ing you
here instead of Brendan:

https://lore.kernel.org/linux-mm/20260914155115.439742-1-gourry@xxxxxxxxxx/

Do you have any concerns with me trying to pull this plumbing out ahead?
Trying my best not to cause annoying conflicts.

~Gregory

---

as an example, this series commit 20/26 reduces in size to the below if
the plumbing it pulled out ahead:


diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2e079fa3a729..bb43568bb468 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5192,7 +5192,16 @@ static __always_inline bool prepare_alloc_flags(gfp_t *gfp, unsigned int order,
return false;

*prepared_alloc_flags = alloc_flags;
- *fastpath_alloc_flags = alloc_flags;
+
+ /*
+ * The caller may be atomic if it disallows direct reclaim or requests
+ * lockless allocation. Determine this before gfp_allowed_mask can clear
+ * __GFP_DIRECT_RECLAIM.
+ */
+ if ((alloc_flags & ALLOC_NOLOCK) ||
+ !(*gfp & __GFP_DIRECT_RECLAIM))
+ *prepared_alloc_flags |= ALLOC_NOBLOCK;
+ *fastpath_alloc_flags = *prepared_alloc_flags;

if (alloc_flags & ALLOC_NOLOCK) {
/* Certain other flags could be supported later if needed. */
diff --git a/mm/page_alloc.h b/mm/page_alloc.h
index b10f5422b6bc..863074319c2a 100644
--- a/mm/page_alloc.h
+++ b/mm/page_alloc.h
@@ -56,6 +56,7 @@
* alloc_tag_sub_check().
*/
#define ALLOC_NO_CODETAG 0x1000
+#define ALLOC_NOBLOCK 0x4000 /* Caller may be atomic */

/* Flags that allow allocations below the min watermark. */
#define ALLOC_RESERVES (ALLOC_NON_BLOCK|ALLOC_MIN_RESERVE|ALLOC_HIGHATOMIC|ALLOC_OOM)