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: mem_cgroup_get_from_ino() returns NULL on error

Change mem_cgroup_get_from_ino() to return NULL on error instead of
ERR_PTR values. This simplifies the API: NULL indicates failure, and a
valid pointer indicates success with a CSS reference held that the caller
must release via mem_cgroup_put().

Link: https://lkml.kernel.org/r/20251225232116.294540-4-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
510e1290 1d89d7fd

+3 -5
+2 -4
mm/memcontrol.c
··· 3624 3624 { 3625 3625 struct cgroup *cgrp; 3626 3626 struct cgroup_subsys_state *css; 3627 - struct mem_cgroup *memcg; 3627 + struct mem_cgroup *memcg = NULL; 3628 3628 3629 3629 cgrp = cgroup_get_from_id(ino); 3630 3630 if (IS_ERR(cgrp)) 3631 - return ERR_CAST(cgrp); 3631 + return NULL; 3632 3632 3633 3633 css = cgroup_get_e_css(cgrp, &memory_cgrp_subsys); 3634 3634 if (css) 3635 3635 memcg = container_of(css, struct mem_cgroup, css); 3636 - else 3637 - memcg = ERR_PTR(-ENOENT); 3638 3636 3639 3637 cgroup_put(cgrp); 3640 3638
+1 -1
mm/shrinker_debug.c
··· 130 130 131 131 if (shrinker->flags & SHRINKER_MEMCG_AWARE) { 132 132 memcg = mem_cgroup_get_from_ino(ino); 133 - if (!memcg || IS_ERR(memcg)) 133 + if (!memcg) 134 134 return -ENOENT; 135 135 136 136 if (!mem_cgroup_online(memcg)) {