cgroup/cpuset-v1: Add missing support for cpuset_v2_mode
PATCH v2 1/1 cgroup/cpuset-v1: Add missing support for cpuset_v2_mode
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 parameter parsing to the cpuset filesystem type so that cpuset_v2_mode 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/[email protected]/T/
--- kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
kernel/cgroup/cgroup.c +29 -0
@@ -2353,9 +2353,37 @@ static struct file_system_type cgroup2_fs_type = { };#ifdef CONFIG_CPUSETS_V1 +enum cpuset_param { + Opt_cpuset_v2_mode, +}; + +const struct fs_parameter_spec cpuset_fs_parameters[] = { +fsparam_flag ("cpuset_v2_mode" , Opt_cpuset_v2_mode), + {} +}; + +static int cpuset_parse_param (struct fs_context *fc,struct fs_parameter *param) +{ +struct cgroup_fs_context *ctx =cgroup_fc2context (fc); +struct fs_parse_result result; +int opt; + + opt =fs_parse (fc, cpuset_fs_parameters, param, &result); +if (opt <0 ) +return opt; + +switch (opt) { +case Opt_cpuset_v2_mode: + ctx->flags |=CGRP_ROOT_CPUSET_V2_MODE ; +return 0 ; + } +return -EINVAL ; +} +static const struct fs_context_operations cpuset_fs_context_ops = { .get_tree = cgroup1_get_tree, .free = cgroup_fs_context_free, + .parse_param = cpuset_parse_param, };/*
@@ -2392,6 +2420,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 = cpuset_fs_parameters, .fs_flags =FS_USERNS_MOUNT , };#endif
Signature · 1 line
2.49.0.777.g153de2bbd5-goog
Quoted 78 lines · T.J. Mercier
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 commite1cba4b85daa("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup") did not update the special casedcpuset_mount(), and only the cgroup (v1) filesystem type was updated.Add parameter parsing to the cpuset filesystem type so that
cpuset_v2_modeworks 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/[email protected]/T/Fixes e1cba4b85daa ("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup")Signed-off-by T.J. Mercier <[email protected]>--- kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)kernel/cgroup/cgroup.c +28
-0@@ -2353,9 +2353,37 @@ static struct file_system_type cgroup2_fs_type = { };#ifdef CONFIG_CPUSETS_V1 +enum cpuset_param { + Opt_cpuset_v2_mode, +}; + +const struct fs_parameter_spec cpuset_fs_parameters[] = { +fsparam_flag ("cpuset_v2_mode" , Opt_cpuset_v2_mode), + {} +}; + +static int cpuset_parse_param (struct fs_context *fc,struct fs_parameter *param) +{ +struct cgroup_fs_context *ctx =cgroup_fc2context (fc); +struct fs_parse_result result; +int opt; + + opt =fs_parse (fc, cpuset_fs_parameters, param, &result); +if (opt <0 ) +return opt; + +switch (opt) { +case Opt_cpuset_v2_mode: + ctx->flags |=CGRP_ROOT_CPUSET_V2_MODE ; +return 0 ; + } +return -EINVAL ; +} +static const struct fs_context_operations cpuset_fs_context_ops = { .get_tree = cgroup1_get_tree, .free = cgroup_fs_context_free, + .parse_param = cpuset_parse_param, };/*
kernel/cgroup/cgroup.c static int cpuset_init_fs_context(struct fs_context *fc) · line 2426
Quoted 7 lines
kernel/cgroup/cgroup.c +1
-0@@ -2392,6 +2420,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 = cpuset_fs_parameters, .fs_flags =FS_USERNS_MOUNT , };#endif
LGTM
Hi,
Quoted 25 lines · T.J. Mercier
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 commite1cba4b85daa("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup") did not update the special casedcpuset_mount(), and only the cgroup (v1) filesystem type was updated.Add parameter parsing to the cpuset filesystem type so that
cpuset_v2_modeworks 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)
Quoted 6 lines
[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/[email protected]/T/Fixes e1cba4b85daa ("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup")Signed-off-by T.J. Mercier <[email protected]>
The patch looks good to me, please feel free to add
One nit below:
Quoted 10 lines
--- kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)kernel/cgroup/cgroup.c +0
-0@@ -2353,9 +2353,37 @@ static struct file_system_type cgroup2_fs_type = { };
kernel/cgroup/cgroup.c static struct file_system_type cgroup2_fs_type = { · line 2363
Quoted 10 lines
kernel/cgroup/cgroup.c +8
-0#ifdef CONFIG_CPUSETS_V1 +enum cpuset_param { + Opt_cpuset_v2_mode, +}; + +const struct fs_parameter_spec cpuset_fs_parameters[] = { +fsparam_flag ("cpuset_v2_mode" , Opt_cpuset_v2_mode), + {} +};
A minor optimization you may want to convert the cpuset_fs_parameters into a static const.
Signature · 2 lines
Cheers, Kamalesh
On Tue, Apr 15, 2025 at 11:53:07PM +0000, "T.J. Mercier" <[email protected]> wrote:
...
Quoted 2 lines
kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
Quoted 53 lines · Kamalesh Babulal
Hi,
Quoted 25 lines · T.J. Mercier
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 commite1cba4b85daa("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup") did not update the special casedcpuset_mount(), and only the cgroup (v1) filesystem type was updated.Add parameter parsing to the cpuset filesystem type so that
cpuset_v2_modeworks 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)Quoted 6 lines
[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/[email protected]/T/Fixes e1cba4b85daa ("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup")Signed-off-by T.J. Mercier <[email protected]>The patch looks good to me, please feel free to add
Reviewed-by Kamalesh Babulal <[email protected]>One nit below:
Quoted 11 lines
--- kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)kernel/cgroup/cgroup.c +0
-0@@ -2353,9 +2353,37 @@ static struct file_system_type cgroup2_fs_type = { };
Quoted 12 lines
kernel/cgroup/cgroup.c static struct file_system_type cgroup2_fs_type = { · line 2363
Quoted 9 lines
kernel/cgroup/cgroup.c +8
-0#ifdef CONFIG_CPUSETS_V1 +enum cpuset_param { + Opt_cpuset_v2_mode, +}; + +const struct fs_parameter_spec cpuset_fs_parameters[] = { +fsparam_flag ("cpuset_v2_mode" , Opt_cpuset_v2_mode), + {} +};A minor optimization you may want to convert the
cpuset_fs_parametersinto a static const.
Thanks, I copied from cgroup1_fs_parameters since that's where cpuset_v2_mode lives, which doesn't have the static currently (cgroup2_fs_parameters does). Let me update cpuset_fs_parameters in v3, and add a second patch for cgroup1_fs_parameters.
Quoted 4 lines
--
Cheers,
Kamalesh
Quoted 69 lines · T.J. Mercier
Quoted 53 lines · Kamalesh Babulal
Hi,
Quoted 25 lines · T.J. Mercier
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 commite1cba4b85daa("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup") did not update the special casedcpuset_mount(), and only the cgroup (v1) filesystem type was updated.Add parameter parsing to the cpuset filesystem type so that
cpuset_v2_modeworks 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)Quoted 6 lines
[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/[email protected]/T/Fixes e1cba4b85daa ("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup")Signed-off-by T.J. Mercier <[email protected]>The patch looks good to me, please feel free to add
Reviewed-by Kamalesh Babulal <[email protected]>One nit below:
Quoted 11 lines
--- kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)kernel/cgroup/cgroup.c +0
-0@@ -2353,9 +2353,37 @@ static struct file_system_type cgroup2_fs_type = { };Quoted 12 lines
kernel/cgroup/cgroup.c static struct file_system_type cgroup2_fs_type = { · line 2363
Quoted 9 lines
kernel/cgroup/cgroup.c +8
-0#ifdef CONFIG_CPUSETS_V1 +enum cpuset_param { + Opt_cpuset_v2_mode, +}; + +const struct fs_parameter_spec cpuset_fs_parameters[] = { +fsparam_flag ("cpuset_v2_mode" , Opt_cpuset_v2_mode), + {} +};A minor optimization you may want to convert the
cpuset_fs_parametersinto a static const.
Quoted 4 lines
Thanks, I copied from
cgroup1_fs_parameterssince that's wherecpuset_v2_modelives, which doesn't have the static currently (cgroup2_fs_parametersdoes). Let me updatecpuset_fs_parametersin v3, and add a second patch forcgroup1_fs_parameters.
Ah nevermind, cgroup1_fs_parameters needs to be accessible from cgroup.c. So just the v3 update then.
Quoted 5 lines
Quoted 5 lines
--
Cheers,
Kamalesh
Quoted 64 lines · T.J. Mercier
Quoted 51 lines · Kamalesh Babulal
Hi,
Quoted 25 lines · T.J. Mercier
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 commite1cba4b85daa("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup") did not update the special casedcpuset_mount(), and only the cgroup (v1) filesystem type was updated.Add parameter parsing to the cpuset filesystem type so that
cpuset_v2_modeworks 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)Quoted 6 lines
[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/[email protected]/T/Fixes e1cba4b85daa ("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup")Signed-off-by T.J. Mercier <[email protected]>The patch looks good to me, please feel free to add
Reviewed-by Kamalesh Babulal <[email protected]>One nit below:
Quoted 11 lines
--- kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)kernel/cgroup/cgroup.c +0
-0@@ -2353,9 +2353,37 @@ static struct file_system_type cgroup2_fs_type = { };Quoted 11 lines
kernel/cgroup/cgroup.c static struct file_system_type cgroup2_fs_type = { · line 2363
Quoted 9 lines
kernel/cgroup/cgroup.c +8
-0#ifdef CONFIG_CPUSETS_V1 +enum cpuset_param { + Opt_cpuset_v2_mode, +}; + +const struct fs_parameter_spec cpuset_fs_parameters[] = { +fsparam_flag ("cpuset_v2_mode" , Opt_cpuset_v2_mode), + {} +};A minor optimization you may want to convert the
cpuset_fs_parametersinto a static const.
Quoted 4 lines
Thanks, I copied from
cgroup1_fs_parameterssince that's wherecpuset_v2_modelives, which doesn't have the static currently (cgroup2_fs_parametersdoes). Let me updatecpuset_fs_parametersin v3, and add a second patch forcgroup1_fs_parameters.
Besides not exposing the structure outside the current file or maybe a tiny bit of linker speedup, is there other performance benefit by adding "static"?
Regards,
Longman
Quoted 71 lines · Waiman Long
Quoted 64 lines · T.J. Mercier
Quoted 51 lines · Kamalesh Babulal
Hi,
Quoted 25 lines · T.J. Mercier
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 commite1cba4b85daa("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup") did not update the special casedcpuset_mount(), and only the cgroup (v1) filesystem type was updated.Add parameter parsing to the cpuset filesystem type so that
cpuset_v2_modeworks 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)Quoted 6 lines
[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/[email protected]/T/Fixes e1cba4b85daa ("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup")Signed-off-by T.J. Mercier <[email protected]>The patch looks good to me, please feel free to add
Reviewed-by Kamalesh Babulal <[email protected]>One nit below:
Quoted 11 lines
--- kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)kernel/cgroup/cgroup.c +0
-0@@ -2353,9 +2353,37 @@ static struct file_system_type cgroup2_fs_type = { };Quoted 11 lines
kernel/cgroup/cgroup.c static struct file_system_type cgroup2_fs_type = { · line 2363
Quoted 9 lines
kernel/cgroup/cgroup.c +8
-0#ifdef CONFIG_CPUSETS_V1 +enum cpuset_param { + Opt_cpuset_v2_mode, +}; + +const struct fs_parameter_spec cpuset_fs_parameters[] = { +fsparam_flag ("cpuset_v2_mode" , Opt_cpuset_v2_mode), + {} +};A minor optimization you may want to convert the
cpuset_fs_parametersinto a static const.Quoted 4 lines
Thanks, I copied from
cgroup1_fs_parameterssince that's wherecpuset_v2_modelives, which doesn't have the static currently (cgroup2_fs_parametersdoes). Let me updatecpuset_fs_parametersin v3, and add a second patch forcgroup1_fs_parameters.
Quoted 7 lines
Besides not exposing the structure outside the current file or maybe a tiny bit of linker speedup, is there other performance benefit by adding "static"?
Regards,
Longman
I thought it might decrease the text size a tiny bit, but it doesn't because the symbol isn't exported and I guess the compiler knows to just inline.
Quoted 74 lines · T.J. Mercier
Quoted 73 lines · Waiman Long
Quoted 64 lines · T.J. Mercier
Quoted 51 lines · Kamalesh Babulal
Hi,
Quoted 25 lines · T.J. Mercier
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 commite1cba4b85daa("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup") did not update the special casedcpuset_mount(), and only the cgroup (v1) filesystem type was updated.Add parameter parsing to the cpuset filesystem type so that
cpuset_v2_modeworks 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)Quoted 6 lines
[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/[email protected]/T/Fixes e1cba4b85daa ("cgroup: Add mount flag to enable cpuset to use v2 behavior in v1 cgroup")Signed-off-by T.J. Mercier <[email protected]>The patch looks good to me, please feel free to add
Reviewed-by Kamalesh Babulal <[email protected]>One nit below:
Quoted 11 lines
--- kernel/cgroup/cgroup.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)kernel/cgroup/cgroup.c +0
-0@@ -2353,9 +2353,37 @@ static struct file_system_type cgroup2_fs_type = { };Quoted 11 lines
kernel/cgroup/cgroup.c static struct file_system_type cgroup2_fs_type = { · line 2363
Quoted 9 lines
kernel/cgroup/cgroup.c +8
-0#ifdef CONFIG_CPUSETS_V1 +enum cpuset_param { + Opt_cpuset_v2_mode, +}; + +const struct fs_parameter_spec cpuset_fs_parameters[] = { +fsparam_flag ("cpuset_v2_mode" , Opt_cpuset_v2_mode), + {} +};A minor optimization you may want to convert the
cpuset_fs_parametersinto a static const.Quoted 4 lines
Thanks, I copied from
cgroup1_fs_parameterssince that's wherecpuset_v2_modelives, which doesn't have the static currently (cgroup2_fs_parametersdoes). Let me updatecpuset_fs_parametersin v3, and add a second patch forcgroup1_fs_parameters.Besides not exposing the structure outside the current file or maybe a tiny bit of linker speedup, is there other performance benefit by adding "static"?
Quoted 7 lines
Quoted 3 lines
Regards,
LongmanI thought it might decrease the text size a tiny bit, but it doesn't because the symbol isn't exported and I guess the compiler knows to just inline.
Since the structure already have a "const" modifier, I doubt there is any further optimization that the compiler can do whether the symbol is visible externally or not. Anyway, I am not objecting to v3 with static modifier added.
Cheers,
Longman