From: Richard Cheng <icheng@nvidia.com>
To: "Gregory Price (Meta)" <gourry@gourry.net>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, linux-doc@vger.kernel.org,
driver-core@lists.linux.dev, linux-serial@vger.kernel.org,
linux-pm@vger.kernel.org, damon@lists.linux.dev,
linux-cxl@vger.kernel.org, akpm@linux-foundation.org,
david@kernel.org, liam@infradead.org, vbabka@kernel.org,
rppt@kernel.org, surenb@google.com, mhocko@suse.com,
corbet@lwn.net, skhan@linuxfoundation.org,
rdunlap@infradead.org, gregkh@linuxfoundation.org,
rafael@kernel.org, dakr@kernel.org, johan@kernel.org,
jirislaby@kernel.org, kasong@tencent.com, qi.zheng@linux.dev,
shakeel.butt@linux.dev, baohua@kernel.org,
axelrasmussen@google.com, yuanchu@google.com,
weixugc@google.com, baoquan.he@linux.dev,
baolin.wang@linux.alibaba.com, yury.norov@gmail.com,
linux@rasmusvillemoes.dk, pavel@kernel.org, lenb@kernel.org,
hannes@cmpxchg.org, brendan.jackman@linux.dev, ziy@nvidia.com,
sj@kernel.org, muchun.song@linux.dev, osalvador@suse.de,
nico.pache@linux.dev, ryan.roberts@arm.com, dev.jain@arm.com,
lance.yang@linux.dev, usama.arif@linux.dev, kas@kernel.org,
xu.xin@linux.dev, chengming.zhou@linux.dev,
joshua.hahnjy@gmail.com, rakie.kim@sk.com,
ying.huang@linux.alibaba.com, matthew.brost@intel.com,
byungchul@sk.com, apopple@nvidia.com, rientjes@google.com
Subject: Re: [PATCH 00/22] mm: introduce N_MEMORY_COMMON
Date: Wed, 18 Nov 2026 15:01:19 +0800 [thread overview]
Message-ID: <av1DvCQd_OvkGgLU@MWDK4CY14F> (raw)
In-Reply-To: <20261114070959.3490008-1-gourry@gourry.net>
On Sat, Nov 14, 2026 at 02:09:37AM +0800, Gregory Price (Meta) wrote:
> This is phase 1 of the Private NUMA node series.
>
> I will send v6 "Private Memory NUMA nodes" (phases 2 and 3) separately
> next week for further discussion - but I pulled this out ahead to make
> the core filtering mechanism easier to review.
>
> The series is now broken up like so:
>
> Phase 1: Introduce N_MEMORY_COMMON to define "general purpose" (common)
> memory as a concept separate from a node having memory as a
> topological feature (N_MEMORY).
>
> This phase is a no-op for existing systems, but creates the
> baseline for ensuring private node memory is default opted-out
> of being touched by MM (much like ZONE_DEVICE).
>
>
> Phase 2: Introduce N_MEMORY_PRIVATE to define memory not part of the
> general purpose pool. With this we can introduce a minimum set
> of KUnit tests for the page allocator to demonstrate the
> isolation mechanism.
>
> At this point it will be possible for a driver to re-use the
> buddy allocator to make uniform order-N allocations.
>
>
> Phase 3: Introduce feature bits (COMPACTION, RECLAIM, MEMPOLICY) which
> is the minimum viable set to allow userland to manage a private
> memory node via mbind() and migrate_pages().
>
> This enables management of HBM and Coherent GPU memory via
> userland tools (numactl, cpuset) while protecting them from
> incidental allocation (no fallbacks, only explicit placement).
>
> The memory could even be hotplugged in ZONE_NORMAL and pinned.
>
> Actual cover letter for this portion
> ====================================
>
> N_MEMORY has two meanings today:
> 1) this node has memory
> 2) ordinary allocations and MM services can use this node's memory
>
> The two are the same today. They stop being the same once a NUMA node
> with memory isn't part of the general allocation pool.
>
> This series adds N_MEMORY_COMMON for the second meaning and converts
> the relevant N_MEMORY users accordingly. N_MEMORY continues reporting
> memory topology - and some users (cpusets) still utilize it.
>
> At the end of this series, N_MEMORY == N_MEMORY_COMMON, so the series
> changes no behavior for existing systems. A later series will add memory
> outside N_MEMORY_COMMON without having to audit every N_MEMORY user again.
>
> Rather than add new hooks for page-table and pfn walkers, we consolidate
> existing ZONE_DEVICE checks (page/folio_is_zone_device()) into a general
> `page/folio_is_common_memory()` check.
>
> The series is laid out as:
>
> 1-3 helper functions to check node states and a folio's
> membership to a common memory node. N_MEMORY_COMMON itself, and
> the `has_common_memory` sysfs ABI.
> 4 zonelists: the fallback lists hold common nodes, and a node's
> __GFP_THISNODE list is built only for a common node
> 5-21 N_MEMORY->N_MEMORY_COMMON and zone_device -> common_memory
> conversions. One component per patch.
> 22 removal of first_memory_node/next_memory_node, which no longer
> have users after this series.
>
> Each conversion restricts or adjusts:
> - an MM service (reclaim, compaction, KSM, collapse, etc)
> - an allocation target to common memory
> - accounting meant for ordinary allocations from common memory only
>
> has_common_memory lists the same nodes as has_memory until memory
> outside N_MEMORY_COMMON exists. It is added now so that userspace, such
> as libnuma, can start choosing allocation targets from it, and so that
> the meaning is fixed before anything makes the two lists differ.
>
> first/next_memory_node() is replaced by first/next_node_state().
>
Hi Gregory,
I've browsed through the serie, I'll go into detail in each patch
in the following days, for now I have one general question.
I wonder how the "common memory only" rule is enforced ?
As far as I read it, there're 2 ways:
1. The zonelist, you build them from N_MEMORY_COMMON, so non-common
node isn't in any zonelist.
2. A check at the call site, e.g. node_state(nid, N_MEMORY_COMMON) or
folio_is_common_memory()
Code reaches a node's memory in 3 ways: zonelist, node id, or by folio.
I couldn't find a statement of which mechanism is responsible for which
kind of path.
I see some consistent issues,
1. zonelist paths are covered by way number 1. Some of them also carry
way number 2, some don't
2. node id and folio paths can only be covered by way number 2. Some entry
points have the check, and some do not.
I can't tell when a call site has no check is deliberate or missed.
This matters once non-common node gets its own zonelist, as patch 4 metioned I think?
Could you clarify the rule ? e.g. which zonelist users must filter on N_MEMORY_COMMON
themselves? and why the zonelist alone is not enough for them ?
Whether every path that takes a node id or a folio must check N_MEMORY_COMMON, and
which ones are left for the feature bits in phase 3 ?
Let's get the rule settled down and make it as the foundation as well as phase 2 and
phase 3 ?
Best regards,
Richard Cheng.
> Gregory Price (Meta) (22):
> mm: add node-state-filtered zone and node iterators
> mm: publish and clear node memory states via helpers
> mm: introduce the common-memory node state
> mm/page_alloc: build zonelists from common memory
> mm/mempolicy: keep interleave and tmpfs mount policies on common memory
> mm: base hash distribution on common memory nodes
> mm/memory_hotplug: migrate offlined pages to common memory
> mm/memory-tiers: restrict demotion topology to common memory
> mm/ksm: restrict merging to common memory
> mm/khugepaged: restrict collapse to common memory
> mm/mempolicy: don't NUMA-hint folios outside common memory
> mm/damon: restrict DAMON-native folio operations to common memory
> mm/hugetlb: restrict pool growth to common memory
> mm/page_alloc: count common memory nodes for kswapd recovery
> mm/oom_kill: compare OOM constraints against common memory
> tty/sysrq: use common memory for the manual OOM zonelist
> mm/vmscan: restrict reclaim to common memory
> mm/compaction: restrict compaction to common memory
> mm/migrate: restrict move_pages() destinations to common memory
> PM: hibernate: size the image from common memory
> mm/khugepaged: base the recommended min_free_kbytes on common memory
> nodemask: remove the now-unused first_memory_node/next_memory_node
>
> Documentation/ABI/stable/sysfs-devices-node | 16 +++++++
> Documentation/mm/physical_memory.rst | 8 +++-
> drivers/base/node.c | 2 +
> drivers/tty/sysrq.c | 3 +-
> include/linux/mmzone.h | 46 +++++++++++++++++++++
> include/linux/nodemask.h | 38 +++++++++++++----
> kernel/power/snapshot.c | 7 +++-
> mm/compaction.c | 14 +++----
> mm/damon/ops-common.c | 7 ++--
> mm/damon/vaddr.c | 2 +-
> mm/hugetlb.c | 44 +++++++++-----------
> mm/internal.h | 18 ++++++++
> mm/khugepaged.c | 12 ++++--
> mm/ksm.c | 8 ++--
> mm/memory-tiers.c | 23 ++++++-----
> mm/memory_hotplug.c | 25 ++++++-----
> mm/mempolicy.c | 30 +++++++-------
> mm/migrate.c | 2 +-
> mm/mm_init.c | 16 ++++---
> mm/oom_kill.c | 7 ++--
> mm/page_alloc.c | 43 +++++++++++++------
> mm/vmscan.c | 26 ++++++------
> 22 files changed, 266 insertions(+), 131 deletions(-)
>
> --
> 2.53.1-Meta
>
>
prev parent reply other threads:[~2026-11-18 7:01 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 7:09 Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 01/22] mm: add node-state-filtered zone and node iterators Gregory Price (Meta)
2026-11-18 8:29 ` Richard Cheng
2026-11-14 7:09 ` [PATCH 02/22] mm: publish and clear node memory states via helpers Gregory Price (Meta)
2026-11-18 7:53 ` Richard Cheng
2026-11-14 7:09 ` [PATCH 03/22] mm: introduce the common-memory node state Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 04/22] mm/page_alloc: build zonelists from common memory Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 05/22] mm/mempolicy: keep interleave and tmpfs mount policies on " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 06/22] mm: base hash distribution on common memory nodes Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 07/22] mm/memory_hotplug: migrate offlined pages to common memory Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 08/22] mm/memory-tiers: restrict demotion topology " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 09/22] mm/ksm: restrict merging " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 10/22] mm/khugepaged: restrict collapse " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 11/22] mm/mempolicy: don't NUMA-hint folios outside " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 12/22] mm/damon: restrict DAMON-native folio operations to " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 13/22] mm/hugetlb: restrict pool growth " Gregory Price (Meta)
2026-11-18 7:32 ` Richard Cheng
2026-11-14 7:09 ` [PATCH 14/22] mm/page_alloc: count common memory nodes for kswapd recovery Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 15/22] mm/oom_kill: compare OOM constraints against common memory Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 16/22] tty/sysrq: use common memory for the manual OOM zonelist Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 17/22] mm/vmscan: restrict reclaim to common memory Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 18/22] mm/compaction: restrict compaction " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 19/22] mm/migrate: restrict move_pages() destinations " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 20/22] PM: hibernate: size the image from " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 21/22] mm/khugepaged: base the recommended min_free_kbytes on " Gregory Price (Meta)
2026-11-14 7:09 ` [PATCH 22/22] nodemask: remove the now-unused first_memory_node/next_memory_node Gregory Price (Meta)
2026-11-18 7:01 ` Richard Cheng [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=av1DvCQd_OvkGgLU@MWDK4CY14F \
--to=icheng@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=apopple@nvidia.com \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=baoquan.he@linux.dev \
--cc=brendan.jackman@linux.dev \
--cc=byungchul@sk.com \
--cc=chengming.zhou@linux.dev \
--cc=corbet@lwn.net \
--cc=dakr@kernel.org \
--cc=damon@lists.linux.dev \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=driver-core@lists.linux.dev \
--cc=gourry@gourry.net \
--cc=gregkh@linuxfoundation.org \
--cc=hannes@cmpxchg.org \
--cc=jirislaby@kernel.org \
--cc=johan@kernel.org \
--cc=joshua.hahnjy@gmail.com \
--cc=kas@kernel.org \
--cc=kasong@tencent.com \
--cc=kernel-team@meta.com \
--cc=lance.yang@linux.dev \
--cc=lenb@kernel.org \
--cc=liam@infradead.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=matthew.brost@intel.com \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=nico.pache@linux.dev \
--cc=osalvador@suse.de \
--cc=pavel@kernel.org \
--cc=qi.zheng@linux.dev \
--cc=rafael@kernel.org \
--cc=rakie.kim@sk.com \
--cc=rdunlap@infradead.org \
--cc=rientjes@google.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=shakeel.butt@linux.dev \
--cc=sj@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=weixugc@google.com \
--cc=xu.xin@linux.dev \
--cc=ying.huang@linux.alibaba.com \
--cc=yuanchu@google.com \
--cc=yury.norov@gmail.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®