[PATCH -next] cgroup: don't call cgroup1_pidlist_destroy_all() for v2

Xiu Jianfeng posted 1 patch 2 weeks, 1 day ago
There is a newer version of this series
kernel/cgroup/cgroup-v1.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH -next] cgroup: don't call cgroup1_pidlist_destroy_all() for v2
Posted by Xiu Jianfeng 2 weeks, 1 day ago
From: Xiu Jianfeng <xiujianfeng@huawei.com>

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>
---
 kernel/cgroup/cgroup-v1.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 520a11cb12f4..46d89157d558 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -197,6 +197,8 @@ void cgroup1_pidlist_destroy_all(struct cgroup *cgrp)
 {
 	struct cgroup_pidlist *l, *tmp_l;
 
+	if (cgroup_on_dfl(cgrp))
+		return;
 	mutex_lock(&cgrp->pidlist_mutex);
 	list_for_each_entry_safe(l, tmp_l, &cgrp->pidlists, links)
 		mod_delayed_work(cgroup_pidlist_destroy_wq, &l->destroy_dwork, 0);
-- 
2.34.1
Re: [PATCH -next] cgroup: don't call cgroup1_pidlist_destroy_all() for v2
Posted by Tejun Heo 2 weeks ago
Hello,

On Wed, Apr 17, 2024 at 02:13:59AM +0000, Xiu Jianfeng wrote:
> From: Xiu Jianfeng <xiujianfeng@huawei.com>
> 
> 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>
> ---
>  kernel/cgroup/cgroup-v1.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
> index 520a11cb12f4..46d89157d558 100644
> --- a/kernel/cgroup/cgroup-v1.c
> +++ b/kernel/cgroup/cgroup-v1.c
> @@ -197,6 +197,8 @@ void cgroup1_pidlist_destroy_all(struct cgroup *cgrp)
>  {
>  	struct cgroup_pidlist *l, *tmp_l;
>  
> +	if (cgroup_on_dfl(cgrp))
> +		return;

Can you move the test to the caller?

Thanks.

-- 
tejun
Re: [PATCH -next] cgroup: don't call cgroup1_pidlist_destroy_all() for v2
Posted by xiujianfeng 2 weeks ago
Hi,

On 2024/4/18 10:02, Tejun Heo wrote:
> Hello,
> 
> On Wed, Apr 17, 2024 at 02:13:59AM +0000, Xiu Jianfeng wrote:
>> From: Xiu Jianfeng <xiujianfeng@huawei.com>
>>
>> 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>
>> ---
>>  kernel/cgroup/cgroup-v1.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
>> index 520a11cb12f4..46d89157d558 100644
>> --- a/kernel/cgroup/cgroup-v1.c
>> +++ b/kernel/cgroup/cgroup-v1.c
>> @@ -197,6 +197,8 @@ void cgroup1_pidlist_destroy_all(struct cgroup *cgrp)
>>  {
>>  	struct cgroup_pidlist *l, *tmp_l;
>>  
>> +	if (cgroup_on_dfl(cgrp))
>> +		return;
> 
> Can you move the test to the caller?

Sure, will do in v2.

> 
> Thanks.
>