Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

memcg: expose mem_cgroup_ino() and mem_cgroup_get_from_ino() unconditionally

Remove the CONFIG_SHRINKER_DEBUG guards around mem_cgroup_ino() and
mem_cgroup_get_from_ino(). These APIs provide a way to get a memcg's
cgroup inode number and to look up a memcg from an inode number
respectively.

Making these functions unconditionally available allows other in-kernel
users to leverage them without requiring CONFIG_SHRINKER_DEBUG to be
enabled.

No functional change for existing users.

Link: https://lkml.kernel.org/r/20251225232116.294540-3-shakeel.butt@linux.dev
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: David Hildenbrand <david@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Qi Zheng <zhengqi.arch@bytedance.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: SeongJae Park <sj@kernel.org>
Cc: Wei Xu <weixugc@google.com>
Cc: Yuanchu Xie <yuanchu@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Shakeel Butt and committed by
Andrew Morton
1d89d7fd e77786b4

-6
-4
include/linux/memcontrol.h
··· 836 836 } 837 837 struct mem_cgroup *mem_cgroup_from_id(unsigned short id); 838 838 839 - #ifdef CONFIG_SHRINKER_DEBUG 840 839 static inline unsigned long mem_cgroup_ino(struct mem_cgroup *memcg) 841 840 { 842 841 return memcg ? cgroup_ino(memcg->css.cgroup) : 0; 843 842 } 844 843 845 844 struct mem_cgroup *mem_cgroup_get_from_ino(unsigned long ino); 846 - #endif 847 845 848 846 static inline struct mem_cgroup *mem_cgroup_from_seq(struct seq_file *m) 849 847 { ··· 1306 1308 return NULL; 1307 1309 } 1308 1310 1309 - #ifdef CONFIG_SHRINKER_DEBUG 1310 1311 static inline unsigned long mem_cgroup_ino(struct mem_cgroup *memcg) 1311 1312 { 1312 1313 return 0; ··· 1315 1318 { 1316 1319 return NULL; 1317 1320 } 1318 - #endif 1319 1321 1320 1322 static inline struct mem_cgroup *mem_cgroup_from_seq(struct seq_file *m) 1321 1323 {
-2
mm/memcontrol.c
··· 3620 3620 return mem_cgroup_from_private_id(id); 3621 3621 } 3622 3622 3623 - #ifdef CONFIG_SHRINKER_DEBUG 3624 3623 struct mem_cgroup *mem_cgroup_get_from_ino(unsigned long ino) 3625 3624 { 3626 3625 struct cgroup *cgrp; ··· 3640 3641 3641 3642 return memcg; 3642 3643 } 3643 - #endif 3644 3644 3645 3645 static void free_mem_cgroup_per_node_info(struct mem_cgroup_per_node *pn) 3646 3646 {