[RFC PATCH 1/6] mm/memory-tiers: Introduce tier-aware memcg limit sysfs

From: Joshua Hahn

Date: Mon Feb 23 2026 - 17:38:43 EST


Introduce a sysfs entry /sys/kernel/mm/numa/tier_aware_memcg to allow
users to toggle between memcg limits that are proportional to the
system's toptier:total capacity ratio.

Signed-off-by: Joshua Hahn <joshua.hahnjy@xxxxxxxxx>
---
include/linux/memory-tiers.h | 1 +
mm/memory-tiers.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)

diff --git a/include/linux/memory-tiers.h b/include/linux/memory-tiers.h
index 96987d9d95a8..85440473effb 100644
--- a/include/linux/memory-tiers.h
+++ b/include/linux/memory-tiers.h
@@ -37,6 +37,7 @@ struct access_coordinate;

#ifdef CONFIG_NUMA
extern bool numa_demotion_enabled;
+extern bool tier_aware_memcg_limits;
extern struct memory_dev_type *default_dram_type;
extern nodemask_t default_dram_nodes;
struct memory_dev_type *alloc_memory_type(int adistance);
diff --git a/mm/memory-tiers.c b/mm/memory-tiers.c
index 545e34626df7..a88256381519 100644
--- a/mm/memory-tiers.c
+++ b/mm/memory-tiers.c
@@ -939,6 +939,8 @@ subsys_initcall(memory_tier_init);

bool numa_demotion_enabled = false;

+bool tier_aware_memcg_limits;
+
#ifdef CONFIG_MIGRATION
#ifdef CONFIG_SYSFS
static ssize_t demotion_enabled_show(struct kobject *kobj,
@@ -975,8 +977,28 @@ static ssize_t demotion_enabled_store(struct kobject *kobj,
static struct kobj_attribute numa_demotion_enabled_attr =
__ATTR_RW(demotion_enabled);

+static ssize_t tier_aware_memcg_show(struct kobject *kobj,
+ struct kobj_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "%s\n", str_true_false(tier_aware_memcg_limits));
+}
+
+static ssize_t tier_aware_memcg_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
+{
+ if (kstrtobool(buf, &tier_aware_memcg_limits))
+ return -EINVAL;
+
+ return count;
+}
+
+static struct kobj_attribute numa_tier_aware_memcg_attr =
+ __ATTR_RW(tier_aware_memcg);
+
static struct attribute *numa_attrs[] = {
&numa_demotion_enabled_attr.attr,
+ &numa_tier_aware_memcg_attr.attr,
NULL,
};

--
2.47.3