Re: [PATCH v2] mm: memcontrol: fix rcu unbalance in get_non_dying_memcg_end()
From: Andrew Morton
Date: Tue Apr 28 2026 - 18:13:12 EST
On Tue, 28 Apr 2026 18:31:08 +0800 Qi Zheng <qi.zheng@xxxxxxxxx> wrote:
> Currently, get_non_dying_memcg_start() and get_non_dying_memcg_end() both
> evaluate cgroup_subsys_on_dfl(memory_cgrp_subsys) independently to
> determine whether to acquire or release the RCU read lock.
Sashiko review
(https://sashiko.dev/#/patchset/20260428103108.45719-1-qi.zheng@xxxxxxxxx)
is correct.
mm/memcontrol.c: In function 'mod_memcg_state':
mm/memcontrol.c:881:9: error: 'rcu_locked' is used uninitialized [-Werror=uninitialized]
881 | get_non_dying_memcg_end(rcu_locked);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/memcontrol.c:874:14: note: 'rcu_locked' was declared here
874 | bool rcu_locked;
| ^~~~~~~~~~
In function 'mod_memcg_lruvec_state',
inlined from 'mod_lruvec_state' at mm/memcontrol.c:973:3:
mm/memcontrol.c:952:9: error: 'rcu_locked' is used uninitialized [-Werror=uninitialized]
952 | get_non_dying_memcg_end(rcu_locked);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/memcontrol.c:944:14: note: 'rcu_locked' was declared here
944 | bool rcu_locked;
| ^~~~~~~~~~
In function 'mod_memcg_state',
inlined from 'mem_cgroup_sk_uncharge' at mm/memcontrol.c:5392:2:
mm/memcontrol.c:881:9: error: 'rcu_locked' is used uninitialized [-Werror=uninitialized]
881 | get_non_dying_memcg_end(rcu_locked);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mm/memcontrol.c:874:14: note: 'rcu_locked' was declared here
874 | bool rcu_locked;
| ^~~~~~~~~~