cgroup: Fix incorrect WARN_ON_ONCE() in css_release_work_fn()
PATCH 1/1 cgroup: Fix incorrect WARN_ON_ONCE() in css_release_work_fn()
It turns out that the WARN_ON_ONCE() call in css_release_work_fn introduced by commit ab0312526867 ("cgroup: Show # of subsystem CSSes in cgroup.stat") is incorrect. Although css->nr_descendants must be 0 when a css is released and ready to be freed, the corresponding cgrp->nr_dying_subsys[ss->id] may not be 0 if a subsystem is activated and deactivated multiple times with one or more of its previous activation leaving behind dying csses.
Fix the incorrect warning by removing the cgrp->nr_dying_subsys check.
--- kernel/cgroup/cgroup.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
kernel/cgroup/cgroup.c +8 -1
@@ -5465,7 +5465,14 @@ static void css_release_work_fn(struct work_struct *work) ss->css_released (css); cgrp->nr_dying_subsys[ss->id]--; -WARN_ON_ONCE (css->nr_descendants || cgrp->nr_dying_subsys[ss->id]); +/* +* When a css is released and ready to be freed, its +* nr_descendants must be zero. However, the corresponding +* cgrp->nr_dying_subsys[ss->id] may not be 0 if a subsystem +* is activated and deactivated multiple times with one or +* more of its previous activation leaving behind dying csses. +*/ +WARN_ON_ONCE (css->nr_descendants); parent_cgrp =cgroup_parent (cgrp);while (parent_cgrp) { parent_cgrp->nr_dying_subsys[ss->id]--;
Signature · 1 line
2.43.5
Quoted 8 lines · Waiman Long
It turns out that the
WARN_ON_ONCE()call incss_release_work_fnintroduced by commitab0312526867("cgroup: Show # of subsystem CSSes in cgroup.stat") is incorrect. Althoughcss->nr_descendantsmust be 0 when a css is released and ready to be freed, the corresponding cgrp->nr_dying_subsys[ss->id] may not be 0 if a subsystem is activated and deactivated multiple times with one or more of its previous activation leaving behind dying csses.
Quoted 5 lines
Fix the incorrect warning by removing the
cgrp->nr_dying_subsyscheck.Fixes ab0312526867 ("cgroup: Show # of subsystem CSSes in cgroup.stat")Signed-off-by Waiman Long <[email protected]>
Applied to cgroup/for-6.12.
Thanks.
Signature · 1 line
tejun