cgroup: don't call cgroup1_pidlist_destroy_all() for v2
authorXiu Jianfeng <xiujianfeng@huawei.com>
Thu, 18 Apr 2024 02:19:30 +0000 (02:19 +0000)
committerTejun Heo <tj@kernel.org>
Thu, 18 Apr 2024 15:56:58 +0000 (05:56 -1000)
Currently cgroup1_pidlist_destroy_all() will be called when releasing
cgroup even if the cgroup is on default hierarchy, however it doesn't
make any sense for v2 to destroy pidlist of v1.

Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cgroup.c

index a66c088c851cfb87036ccc93317f7357769cb268..e32b6972c47840a8f6880964100b3356ab849f2a 100644 (file)
@@ -5368,7 +5368,8 @@ static void css_free_rwork_fn(struct work_struct *work)
        } else {
                /* cgroup free path */
                atomic_dec(&cgrp->root->nr_cgrps);
-               cgroup1_pidlist_destroy_all(cgrp);
+               if (!cgroup_on_dfl(cgrp))
+                       cgroup1_pidlist_destroy_all(cgrp);
                cancel_work_sync(&cgrp->release_agent_work);
                bpf_cgrp_storage_free(cgrp);