From: Shakeel Butt <shakeel.butt@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Muchun Song <muchun.song@linux.dev>,
SeongJae Park <sj@kernel.org>,
Meta kernel team <kernel-team@meta.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
damon@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH 8/8] memcg: rename mem_cgroup_ino() to mem_cgroup_id()
Date: Thu, 25 Dec 2025 15:21:16 -0800 [thread overview]
Message-ID: <20251225232116.294540-9-shakeel.butt@linux.dev> (raw)
In-Reply-To: <20251225232116.294540-1-shakeel.butt@linux.dev>
Rename mem_cgroup_ino() to mem_cgroup_id() and mem_cgroup_get_from_ino()
to mem_cgroup_get_from_id(). These functions now use cgroup IDs (from
cgroup_id()) rather than inode numbers, so the names should reflect that.
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
---
include/linux/memcontrol.h | 8 ++++----
mm/damon/core.c | 2 +-
mm/damon/ops-common.c | 2 +-
mm/damon/sysfs-schemes.c | 2 +-
mm/memcontrol.c | 2 +-
mm/shrinker_debug.c | 10 +++++-----
mm/vmscan.c | 6 +++---
7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 3e7d69020b39..5a1161cadb8d 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -830,12 +830,12 @@ static inline unsigned short mem_cgroup_private_id(struct mem_cgroup *memcg)
}
struct mem_cgroup *mem_cgroup_from_private_id(unsigned short id);
-static inline u64 mem_cgroup_ino(struct mem_cgroup *memcg)
+static inline u64 mem_cgroup_id(struct mem_cgroup *memcg)
{
return memcg ? cgroup_id(memcg->css.cgroup) : 0;
}
-struct mem_cgroup *mem_cgroup_get_from_ino(u64 ino);
+struct mem_cgroup *mem_cgroup_get_from_id(u64 ino);
static inline struct mem_cgroup *mem_cgroup_from_seq(struct seq_file *m)
{
@@ -1288,12 +1288,12 @@ static inline struct mem_cgroup *mem_cgroup_from_private_id(unsigned short id)
return NULL;
}
-static inline u64 mem_cgroup_ino(struct mem_cgroup *memcg)
+static inline u64 mem_cgroup_id(struct mem_cgroup *memcg)
{
return 0;
}
-static inline struct mem_cgroup *mem_cgroup_get_from_ino(u64 ino)
+static inline struct mem_cgroup *mem_cgroup_get_from_id(u64 ino)
{
return NULL;
}
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 23c44811ff7f..a2513db59aee 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2065,7 +2065,7 @@ static unsigned long damos_get_node_memcg_used_bp(
unsigned long used_pages, numerator;
struct sysinfo i;
- memcg = mem_cgroup_get_from_ino(goal->memcg_id);
+ memcg = mem_cgroup_get_from_id(goal->memcg_id);
if (!memcg) {
if (goal->metric == DAMOS_QUOTA_NODE_MEMCG_USED_BP)
return 0;
diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
index dd81db95f901..a218d9922234 100644
--- a/mm/damon/ops-common.c
+++ b/mm/damon/ops-common.c
@@ -274,7 +274,7 @@ bool damos_folio_filter_match(struct damos_filter *filter, struct folio *folio)
if (!memcg)
matched = false;
else
- matched = filter->memcg_id == mem_cgroup_ino(memcg);
+ matched = filter->memcg_id == mem_cgroup_id(memcg);
rcu_read_unlock();
break;
case DAMOS_FILTER_TYPE_YOUNG:
diff --git a/mm/damon/sysfs-schemes.c b/mm/damon/sysfs-schemes.c
index 79aa917ab3c0..3beb4456aa51 100644
--- a/mm/damon/sysfs-schemes.c
+++ b/mm/damon/sysfs-schemes.c
@@ -2511,7 +2511,7 @@ static int damon_sysfs_memcg_path_to_id(char *memcg_path, u64 *id)
if (!mem_cgroup_online(memcg))
continue;
if (damon_sysfs_memcg_path_eq(memcg, path, memcg_path)) {
- *id = mem_cgroup_ino(memcg);
+ *id = mem_cgroup_id(memcg);
found = true;
break;
}
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index ede39dde05df..5b2925a68832 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3615,7 +3615,7 @@ struct mem_cgroup *mem_cgroup_from_private_id(unsigned short id)
return xa_load(&mem_cgroup_private_ids, id);
}
-struct mem_cgroup *mem_cgroup_get_from_ino(u64 ino)
+struct mem_cgroup *mem_cgroup_get_from_id(u64 ino)
{
struct cgroup *cgrp;
struct cgroup_subsys_state *css;
diff --git a/mm/shrinker_debug.c b/mm/shrinker_debug.c
index 7ef16a0b2959..affa64437302 100644
--- a/mm/shrinker_debug.c
+++ b/mm/shrinker_debug.c
@@ -70,7 +70,7 @@ static int shrinker_debugfs_count_show(struct seq_file *m, void *v)
memcg_aware ? memcg : NULL,
count_per_node);
if (total) {
- seq_printf(m, "%llu", mem_cgroup_ino(memcg));
+ seq_printf(m, "%llu", mem_cgroup_id(memcg));
for_each_node(nid)
seq_printf(m, " %lu", count_per_node[nid]);
seq_putc(m, '\n');
@@ -107,7 +107,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file,
{
struct shrinker *shrinker = file->private_data;
unsigned long nr_to_scan = 0, read_len;
- u64 ino;
+ u64 id;
struct shrink_control sc = {
.gfp_mask = GFP_KERNEL,
};
@@ -120,7 +120,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file,
return -EFAULT;
kbuf[read_len] = '\0';
- if (sscanf(kbuf, "%llu %d %lu", &ino, &nid, &nr_to_scan) != 3)
+ if (sscanf(kbuf, "%llu %d %lu", &id, &nid, &nr_to_scan) != 3)
return -EINVAL;
if (nid < 0 || nid >= nr_node_ids)
@@ -130,7 +130,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file,
return size;
if (shrinker->flags & SHRINKER_MEMCG_AWARE) {
- memcg = mem_cgroup_get_from_ino(ino);
+ memcg = mem_cgroup_get_from_id(id);
if (!memcg)
return -ENOENT;
@@ -138,7 +138,7 @@ static ssize_t shrinker_debugfs_scan_write(struct file *file,
mem_cgroup_put(memcg);
return -ENOENT;
}
- } else if (ino != 0) {
+ } else if (id != 0) {
return -EINVAL;
}
diff --git a/mm/vmscan.c b/mm/vmscan.c
index d78043c7e4af..9ad2c2f06bfa 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -5426,7 +5426,7 @@ static int lru_gen_seq_show(struct seq_file *m, void *v)
if (memcg)
cgroup_path(memcg->css.cgroup, m->private, PATH_MAX);
#endif
- seq_printf(m, "memcg %llu %s\n", mem_cgroup_ino(memcg), path);
+ seq_printf(m, "memcg %llu %s\n", mem_cgroup_id(memcg), path);
}
seq_printf(m, " node %5d\n", nid);
@@ -5522,12 +5522,12 @@ static int run_cmd(char cmd, u64 memcg_id, int nid, unsigned long seq,
return -EINVAL;
if (!mem_cgroup_disabled()) {
- memcg = mem_cgroup_get_from_ino(memcg_id);
+ memcg = mem_cgroup_get_from_id(memcg_id);
if (!memcg)
return -EINVAL;
}
- if (memcg_id != mem_cgroup_ino(memcg))
+ if (memcg_id != mem_cgroup_id(memcg))
goto done;
sc->target_mem_cgroup = memcg;
--
2.47.3
next prev parent reply other threads:[~2025-12-25 23:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-25 23:21 [PATCH 0/8] memcg: separate private and public ID namespaces Shakeel Butt
2025-12-25 23:21 ` [PATCH 1/8] memcg: introduce private id API for in-kernel users Shakeel Butt
2025-12-25 23:21 ` [PATCH 2/8] memcg: expose mem_cgroup_ino() and mem_cgroup_get_from_ino() unconditionally Shakeel Butt
2025-12-25 23:21 ` [PATCH 3/8] memcg: mem_cgroup_get_from_ino() returns NULL on error Shakeel Butt
2025-12-25 23:21 ` [PATCH 4/8] memcg: use cgroup_id() instead of cgroup_ino() for memcg ID Shakeel Butt
2025-12-25 23:21 ` [PATCH 5/8] mm/damon: use cgroup ID instead of private " Shakeel Butt
2025-12-26 18:23 ` SeongJae Park
2025-12-25 23:21 ` [PATCH 6/8] mm/vmscan: use cgroup ID instead of private memcg ID in lru_gen interface Shakeel Butt
2025-12-25 23:21 ` [PATCH 7/8] memcg: remove unused mem_cgroup_id() and mem_cgroup_from_id() Shakeel Butt
2025-12-25 23:21 ` Shakeel Butt [this message]
2025-12-26 12:31 ` [PATCH 8/8] memcg: rename mem_cgroup_ino() to mem_cgroup_id() kernel test robot
2025-12-27 22:12 ` SeongJae Park
2025-12-26 13:23 ` kernel test robot
2025-12-26 18:17 ` [PATCH 0/8] memcg: separate private and public ID namespaces SeongJae Park
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=20251225232116.294540-9-shakeel.butt@linux.dev \
--to=shakeel.butt@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=damon@lists.linux.dev \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=muchun.song@linux.dev \
--cc=roman.gushchin@linux.dev \
--cc=sj@kernel.org \
/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