2024-04-19 09:01:53

by Xiu Jianfeng

[permalink] [raw]
Subject: [PATCH -next] cgroup: avoid invalid loop in cgroup_no_v1()

We should break the for_each_subsys loop after the token matches
the name of subsys and cgroup_no_v1_mask is set.

Signed-off-by: Xiu Jianfeng <[email protected]>
---
kernel/cgroup/cgroup-v1.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 520a11cb12f4..b9dbf6bf2779 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -1335,6 +1335,7 @@ static int __init cgroup_no_v1(char *str)
continue;

cgroup_no_v1_mask |= 1 << i;
+ break;
}
}
return 1;
--
2.34.1



2024-04-19 15:45:32

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH -next] cgroup: avoid invalid loop in cgroup_no_v1()

Hello,

Applied to cgroup/for-6.10 w/ title and commit message updates.

Thanks.

----- 8< -----
From 19fc8a896565ecebb3951664fd0eeab0a80314a1 Mon Sep 17 00:00:00 2001
From: Xiu Jianfeng <[email protected]>
Date: Fri, 19 Apr 2024 08:53:16 +0000
Subject: [PATCH] cgroup: Avoid unnecessary looping in cgroup_no_v1()

No need to continue the for_each_subsys loop after the token matches the
name of subsys and cgroup_no_v1_mask is set.

Signed-off-by: Xiu Jianfeng <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
---
kernel/cgroup/cgroup-v1.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
index 520a11cb12f4..b9dbf6bf2779 100644
--- a/kernel/cgroup/cgroup-v1.c
+++ b/kernel/cgroup/cgroup-v1.c
@@ -1335,6 +1335,7 @@ static int __init cgroup_no_v1(char *str)
continue;

cgroup_no_v1_mask |= 1 << i;
+ break;
}
}
return 1;
--
2.44.0