Re: [PATCH] fix: mm: memcontrol: convert objcg to be per-memcg per-node type
From: Usama Arif
Date: Mon Mar 09 2026 - 07:33:54 EST
On 09/03/2026 14:29, Qi Zheng wrote:
> From: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
>
> Reset pn->orig_objcg to NULL to prevent obj_cgroup_put()
> from being called agagin in __mem_cgroup_free().
>
> Reported-by: Usama Arif <usama.arif@xxxxxxxxx>
> Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
> ---
> mm/memcontrol.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 992a3f5caa62b..ad32639ea5959 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4140,8 +4140,14 @@ static int mem_cgroup_css_online(struct cgroup_subsys_state *css)
> for_each_node(nid) {
> struct mem_cgroup_per_node *pn = memcg->nodeinfo[nid];
>
> - if (pn && pn->orig_objcg)
> + if (pn && pn->orig_objcg) {
> obj_cgroup_put(pn->orig_objcg);
> + /*
> + * Reset pn->orig_objcg to NULL to prevent obj_cgroup_put()
> + * from being called agagin in __mem_cgroup_free().
nit: s/agagin/again/
Apart from the nit.
Acked-by: Usama Arif <usama.arif@xxxxxxxxx>
> + */
> + pn->orig_objcg = NULL;
> + }
> }
> free_shrinker_info(memcg);
> offline_kmem: