* + mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch added to mm-new branch
@ 2026-01-08 19:02 Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2026-01-08 19:02 UTC (permalink / raw)
To: mm-commits, zhengqi.arch, yuanchu, weixugc, vbabka, surenb,
shakeel.butt, rppt, rientjes, mhocko, lorenzo.stoakes,
liam.howlett, jonathan.cameron, hannes, david, axelrasmussen,
akinobu.mita, akpm
The patch titled
Subject: mm: memory-tiers, numa_emu: enable to create memory tiers using fake numa nodes
has been added to the -mm mm-new branch. Its filename is
mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Akinobu Mita <akinobu.mita@gmail.com>
Subject: mm: memory-tiers, numa_emu: enable to create memory tiers using fake numa nodes
Date: Thu, 8 Jan 2026 19:15:33 +0900
Patch series "mm: fix oom-killer not being invoked when demotion is
enabled", v3.
On systems with multiple memory-tiers consisting of DRAM and CXL memory,
the OOM killer is not invoked properly.
This patchset includes a fix for the issue and an enhancement that makes
the issue reproducible with numa emulation.
This patch (of 3):
This makes it possible to create memory tiers using fake numa nodes
generated by numa emulation.
The "numa_emulation.adistance=" kernel cmdline option allows you to set
the abstract distance for each NUMA node.
For example, you can create two fake nodes, each in a different memory
tier by booting with "numa=fake=2 numa_emulation.adistance=576,704".
Here, the abstract distances of node0 and node1 are set to 576 and 706,
respectively.
Each memory tier covers an abstract distance chunk size of 128. Thus,
nodes with abstract distances between 512 and 639 are classified into the
same memory tier, and nodes with abstract distances between 640 and 767
are classified into the next slower memory tier.
The abstract distance of fake nodes not specified in the parameter will be
the default DRAM abstract distance of 576.
Link: https://lkml.kernel.org/r/20260108101535.50696-1-akinobu.mita@gmail.com
Link: https://lkml.kernel.org/r/20260108101535.50696-2-akinobu.mita@gmail.com
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/numa_emulation.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
--- a/mm/numa_emulation.c~mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes
+++ a/mm/numa_emulation.c
@@ -6,6 +6,9 @@
#include <linux/errno.h>
#include <linux/topology.h>
#include <linux/memblock.h>
+#include <linux/memory-tiers.h>
+#include <linux/module.h>
+#include <linux/node.h>
#include <linux/numa_memblks.h>
#include <asm/numa.h>
#include <acpi/acpi_numa.h>
@@ -344,6 +347,27 @@ static int __init setup_emu2phys_nid(int
return max_emu_nid;
}
+static int adistance[MAX_NUMNODES];
+module_param_array(adistance, int, NULL, 0400);
+MODULE_PARM_DESC(adistance, "Abstract distance values for each NUMA node");
+
+static int emu_calculate_adistance(struct notifier_block *self,
+ unsigned long nid, void *data)
+{
+ if (adistance[nid]) {
+ int *adist = data;
+
+ *adist = adistance[nid];
+ return NOTIFY_STOP;
+ }
+ return NOTIFY_OK;
+}
+
+static struct notifier_block emu_adist_nb = {
+ .notifier_call = emu_calculate_adistance,
+ .priority = INT_MIN,
+};
+
/**
* numa_emulation - Emulate NUMA nodes
* @numa_meminfo: NUMA configuration to massage
@@ -532,6 +556,8 @@ void __init numa_emulation(struct numa_m
}
}
+ register_mt_adistance_algorithm(&emu_adist_nb);
+
/* free the copied physical distance table */
memblock_free(phys_dist, phys_size);
return;
_
Patches currently in -mm which might be from akinobu.mita@gmail.com are
mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch
mm-numa_emu-add-document-for-numa-emulation.patch
mm-vmscan-dont-demote-if-there-is-not-enough-free-memory-in-the-lower-memory-tier.patch
^ permalink raw reply [flat|nested] 2+ messages in thread* + mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch added to mm-new branch
@ 2025-12-23 1:42 Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2025-12-23 1:42 UTC (permalink / raw)
To: mm-commits, zhengqi.arch, yuanchu, weixugc, vbabka, surenb,
shakeel.butt, rppt, rientjes, mhocko, lorenzo.stoakes,
liam.howlett, hannes, david, axelrasmussen, akinobu.mita, akpm
The patch titled
Subject: mm: memory-tiers, numa_emu: enable to create memory tiers using fake numa nodes
has been added to the -mm mm-new branch. Its filename is
mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch
This patch will shortly appear at
https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch
This patch will later appear in the mm-new branch at
git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews. Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.
The mm-new branch of mm.git is not included in linux-next
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a
reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***
The -mm tree is included into linux-next via various
branches at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there most days
------------------------------------------------------
From: Akinobu Mita <akinobu.mita@gmail.com>
Subject: mm: memory-tiers, numa_emu: enable to create memory tiers using fake numa nodes
Date: Mon, 22 Dec 2025 09:48:32 +0900
Patch series "mm: fix oom-killer not being invoked when demotion is
enabled", v2.
On systems with multiple memory-tiers consisting of DRAM and CXL memory,
the OOM killer is not invoked properly.
This patchset includes a fix for the issue and an enhancement that makes
the issue reproducible with numa emulation.
This patch (of 3):
This makes it possible to create memory tiers using fake numa nodes
generated by numa emulation.
The "numa_emulation.adistance=" kernel cmdline option allows you to set
the abstract distance for each NUMA node.
For example, you can create two fake nodes, each in a different memory
tier by booting with "numa=fake=2 numa_emulation.adistance=576,704".
Here, the abstract distances of node0 and node1 are set to 576 and 706,
respectively.
Each memory tier covers an abstract distance chunk size of 128. Thus,
nodes with abstract distances between 512 and 639 are classified into the
same memory tier, and nodes with abstract distances between 640 and 767
are classified into the next slower memory tier.
The abstract distance of fake nodes not specified in the parameter will be
the default DRAM abstract distance of 576.
Link: https://lkml.kernel.org/r/20251222004834.10539-1-akinobu.mita@gmail.com
Link: https://lkml.kernel.org/r/20251222004834.10539-2-akinobu.mita@gmail.com
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: "David Hildenbrand (Red Hat)" <david@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Liam Howlett <liam.howlett@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Shakeel Butt <shakeel.butt@linux.dev>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/numa_emulation.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
--- a/mm/numa_emulation.c~mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes
+++ a/mm/numa_emulation.c
@@ -6,6 +6,9 @@
#include <linux/errno.h>
#include <linux/topology.h>
#include <linux/memblock.h>
+#include <linux/memory-tiers.h>
+#include <linux/module.h>
+#include <linux/node.h>
#include <linux/numa_memblks.h>
#include <asm/numa.h>
#include <acpi/acpi_numa.h>
@@ -344,6 +347,27 @@ static int __init setup_emu2phys_nid(int
return max_emu_nid;
}
+static int adistance[MAX_NUMNODES];
+module_param_array(adistance, int, NULL, 0400);
+MODULE_PARM_DESC(adistance, "Abstract distance values for each NUMA node");
+
+static int emu_calculate_adistance(struct notifier_block *self,
+ unsigned long nid, void *data)
+{
+ if (adistance[nid]) {
+ int *adist = data;
+
+ *adist = adistance[nid];
+ return NOTIFY_STOP;
+ }
+ return NOTIFY_OK;
+}
+
+static struct notifier_block emu_adist_nb = {
+ .notifier_call = emu_calculate_adistance,
+ .priority = INT_MIN,
+};
+
/**
* numa_emulation - Emulate NUMA nodes
* @numa_meminfo: NUMA configuration to massage
@@ -532,6 +556,8 @@ void __init numa_emulation(struct numa_m
}
}
+ register_mt_adistance_algorithm(&emu_adist_nb);
+
/* free the copied physical distance table */
memblock_free(phys_dist, phys_size);
return;
_
Patches currently in -mm which might be from akinobu.mita@gmail.com are
mm-damon-vaddr-fix-missing-pte_unmap_unlock-in-damos_va_migrate_pmd_entry.patch
mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch
mm-numa_emu-add-document-for-numa-emulation.patch
mm-vmscan-dont-demote-if-there-is-not-enough-free-memory-in-the-lower-memory-tier.patch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-08 19:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08 19:02 + mm-memory-tiers-numa_emu-enable-to-create-memory-tiers-using-fake-numa-nodes.patch added to mm-new branch Andrew Morton
-- strict thread matches above, loose matches on Subject: below --
2025-12-23 1:42 Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.