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: remove unused mem_cgroup_id() and mem_cgroup_from_id()

Now that all callers have been converted to use either:
- The private ID APIs (mem_cgroup_private_id/mem_cgroup_from_private_id)
for internal kernel objects that outlive their cgroup
- The public cgroup ID APIs (mem_cgroup_ino/mem_cgroup_get_from_ino)
for external interfaces

Remove the unused wrapper functions mem_cgroup_id() and
mem_cgroup_from_id() along with their !CONFIG_MEMCG stubs.

Link: https://lkml.kernel.org/r/20251225232116.294540-8-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
2202e3a8 20ccbd89

-23
-18
include/linux/memcontrol.h
··· 830 830 } 831 831 struct mem_cgroup *mem_cgroup_from_private_id(unsigned short id); 832 832 833 - static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg) 834 - { 835 - return mem_cgroup_private_id(memcg); 836 - } 837 - struct mem_cgroup *mem_cgroup_from_id(unsigned short id); 838 - 839 833 static inline u64 mem_cgroup_ino(struct mem_cgroup *memcg) 840 834 { 841 835 return memcg ? cgroup_id(memcg->css.cgroup) : 0; ··· 1274 1280 static inline void mem_cgroup_scan_tasks(struct mem_cgroup *memcg, 1275 1281 int (*fn)(struct task_struct *, void *), void *arg) 1276 1282 { 1277 - } 1278 - 1279 - static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg) 1280 - { 1281 - return 0; 1282 - } 1283 - 1284 - static inline struct mem_cgroup *mem_cgroup_from_id(unsigned short id) 1285 - { 1286 - WARN_ON_ONCE(id); 1287 - /* XXX: This should always return root_mem_cgroup */ 1288 - return NULL; 1289 1283 } 1290 1284 1291 1285 static inline unsigned short mem_cgroup_private_id(struct mem_cgroup *memcg)
-5
mm/memcontrol.c
··· 3615 3615 return xa_load(&mem_cgroup_private_ids, id); 3616 3616 } 3617 3617 3618 - struct mem_cgroup *mem_cgroup_from_id(unsigned short id) 3619 - { 3620 - return mem_cgroup_from_private_id(id); 3621 - } 3622 - 3623 3618 struct mem_cgroup *mem_cgroup_get_from_ino(u64 ino) 3624 3619 { 3625 3620 struct cgroup *cgrp;