* [PATCH] cgroup/cpuset-v1: Add missing support for cpuset_v2_mode
@ 2025-04-14 16:28 T.J. Mercier
2025-04-14 18:26 ` Michal Koutný
0 siblings, 1 reply; 4+ messages in thread
From: T.J. Mercier @ 2025-04-14 16:28 UTC (permalink / raw)
To: Tejun Heo, Johannes Weiner, Michal Koutný, Waiman Long
Cc: T.J. Mercier, cgroups, linux-kernel
Android has mounted the v1 cpuset controller using filesystem type
"cpuset" (not "cgroup") since 2015 [1], and depends on the resulting
behavior where the controller name is not added as a prefix for cgroupfs
files. [2]
Later, a problem was discovered where cpu hotplug onlining did not
affect the cpuset/cpus files, which Android carried an out-of-tree patch
to address for a while. An attempt was made to upstream this patch, but
the recommendation was to use the "cpuset_v2_mode" mount option
instead. [3]
An effort was made to do so, but this fails with "cgroup: Unknown
parameter 'cpuset_v2_mode'" because commit e1cba4b85daa ("cgroup: Add
mount flag to enable cpuset to use v2 behavior in v1 cgroup") did not
update the special cased cpuset_mount(), and only the cgroup (v1)
filesystem type was updated.
Add cgroup v1 parameter parsing to the cpuset filesystem type so that it
works like the cgroup filesystem type:
$ mkdir /dev/cpuset
$ mount -t cpuset -ocpuset_v2_mode none /dev/cpuset
$ mount|grep cpuset
none on /dev/cpuset type cgroup (rw,relatime,cpuset,noprefix,cpuset_v2_mode,release_agent=/sbin/cpuset_release_agent)
[1] https://cs.android.com/android/_/android/platform/system/core/+/b769c8d24fd7be96f8968aa4c80b669525b930d3
[2] https://cs.android.com/android/platform/superproject/main/+/main:system/core/libprocessgroup/setup/cgroup_map_write.cpp;drc=2dac5d89a0f024a2d0cc46a80ba4ee13472f1681;l=192
[3] https://lore.kernel.org/lkml/f795f8be-a184-408a-0b5a-553d26061385@redhat.com/T/
Fixes: e1cba4b85daa ("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup")
Signed-off-by: T.J. Mercier <tjmercier@google.com>
---
kernel/cgroup/cgroup.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 3caf2cd86e65..ceedaf47d494 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2356,6 +2356,7 @@ static struct file_system_type cgroup2_fs_type = {
static const struct fs_context_operations cpuset_fs_context_ops = {
.get_tree = cgroup1_get_tree,
.free = cgroup_fs_context_free,
+ .parse_param = cgroup1_parse_param,
};
/*
@@ -2392,6 +2393,7 @@ static int cpuset_init_fs_context(struct fs_context *fc)
static struct file_system_type cpuset_fs_type = {
.name = "cpuset",
.init_fs_context = cpuset_init_fs_context,
+ .parameters = cgroup1_fs_parameters,
.fs_flags = FS_USERNS_MOUNT,
};
#endif
--
2.49.0.604.gff1f9ca942-goog
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cgroup/cpuset-v1: Add missing support for cpuset_v2_mode
2025-04-14 16:28 [PATCH] cgroup/cpuset-v1: Add missing support for cpuset_v2_mode T.J. Mercier
@ 2025-04-14 18:26 ` Michal Koutný
2025-04-14 20:11 ` Waiman Long
0 siblings, 1 reply; 4+ messages in thread
From: Michal Koutný @ 2025-04-14 18:26 UTC (permalink / raw)
To: T.J. Mercier
Cc: Tejun Heo, Johannes Weiner, Waiman Long, cgroups, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 656 bytes --]
Hello.
On Mon, Apr 14, 2025 at 04:28:41PM +0000, "T.J. Mercier" <tjmercier@google.com> wrote:
> Add cgroup v1 parameter parsing to the cpuset filesystem type so that it
> works like the cgroup filesystem type:
Nothing against 'cpuset_v2_mode' for the cpuset_fs_type (when it's
available on cgroup v1) but isn't it too benevolent reusing all of
cgroup1_fs_parameters? AFAICS, this would allow overriding release agent
also for cpuset fs hierarchies among other options from
cgroup1_fs_parameters.
(This would likely end up with a separate .parse_param callback but I
think that's better than adding so many extra features to cpuset fs.)
Thanks,
Michal
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cgroup/cpuset-v1: Add missing support for cpuset_v2_mode
2025-04-14 18:26 ` Michal Koutný
@ 2025-04-14 20:11 ` Waiman Long
2025-04-14 20:58 ` T.J. Mercier
0 siblings, 1 reply; 4+ messages in thread
From: Waiman Long @ 2025-04-14 20:11 UTC (permalink / raw)
To: Michal Koutný, T.J. Mercier
Cc: Tejun Heo, Johannes Weiner, cgroups, linux-kernel
On 4/14/25 2:26 PM, Michal Koutný wrote:
> Hello.
>
> On Mon, Apr 14, 2025 at 04:28:41PM +0000, "T.J. Mercier" <tjmercier@google.com> wrote:
>> Add cgroup v1 parameter parsing to the cpuset filesystem type so that it
>> works like the cgroup filesystem type:
> Nothing against 'cpuset_v2_mode' for the cpuset_fs_type (when it's
> available on cgroup v1) but isn't it too benevolent reusing all of
> cgroup1_fs_parameters? AFAICS, this would allow overriding release agent
> also for cpuset fs hierarchies among other options from
> cgroup1_fs_parameters.
>
> (This would likely end up with a separate .parse_param callback but I
> think that's better than adding so many extra features to cpuset fs.)
I concur. It should be a separate cpuset_fs_parameters() to handle it
instead of reusing cgroup1_fs_parameters() to allow so many other maybe
irrelevant cgroup1 parameters.
Cheers,
Longman
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cgroup/cpuset-v1: Add missing support for cpuset_v2_mode
2025-04-14 20:11 ` Waiman Long
@ 2025-04-14 20:58 ` T.J. Mercier
0 siblings, 0 replies; 4+ messages in thread
From: T.J. Mercier @ 2025-04-14 20:58 UTC (permalink / raw)
To: Waiman Long
Cc: Michal Koutný, Tejun Heo, Johannes Weiner, cgroups, linux-kernel
On Mon, Apr 14, 2025 at 1:11 PM Waiman Long <llong@redhat.com> wrote:
>
>
> On 4/14/25 2:26 PM, Michal Koutný wrote:
> > Hello.
> >
> > On Mon, Apr 14, 2025 at 04:28:41PM +0000, "T.J. Mercier" <tjmercier@google.com> wrote:
> >> Add cgroup v1 parameter parsing to the cpuset filesystem type so that it
> >> works like the cgroup filesystem type:
> > Nothing against 'cpuset_v2_mode' for the cpuset_fs_type (when it's
> > available on cgroup v1) but isn't it too benevolent reusing all of
> > cgroup1_fs_parameters? AFAICS, this would allow overriding release agent
> > also for cpuset fs hierarchies among other options from
> > cgroup1_fs_parameters.
> >
> > (This would likely end up with a separate .parse_param callback but I
> > think that's better than adding so many extra features to cpuset fs.)
>
> I concur. It should be a separate cpuset_fs_parameters() to handle it
> instead of reusing cgroup1_fs_parameters() to allow so many other maybe
> irrelevant cgroup1 parameters.
>
> Cheers,
> Longman
Hi Michal and Longman,
Yes, that's fair. I'll send a v2 tomorrow.
Thanks,
T.J.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-14 20:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-14 16:28 [PATCH] cgroup/cpuset-v1: Add missing support for cpuset_v2_mode T.J. Mercier
2025-04-14 18:26 ` Michal Koutný
2025-04-14 20:11 ` Waiman Long
2025-04-14 20:58 ` T.J. Mercier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®