cpuset: Allow v2 behavior in v1 cgroup
Subsystems (3)
Waiman Long
maintainerPATCH 1/1 cpuset: Allow v2 behavior in v1 cgroup
Cpuset v2 has some valuable attributes that are not present in v1 because of backward compatibility concern. One of that is the restoration of the original cpu and memory node mask after a hot removal and addition event sequence.
This patch adds a new kernel command line option "cpuset_v2_mode=" to allow cpuset to have v2 behavior in a v1 cgroup when using a non-zero value. This enables users to optionally enable cpuset v2 behavior if they choose to.
--- Documentation/admin-guide/kernel-parameters.txt | 7 ++++ kernel/cgroup/cpuset.c | 46 ++++++++++++++++++------- 2 files changed, 40 insertions(+), 13 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +7 -0
@@ -668,6 +668,13 @@ on every CPU online, such as boot, and resume from suspend. Default: 10000 + cpuset_v2_mode= [KNL] Enable cpuset v2 behavior in cpuset v1 cgroups. + In v2 mode, the cpus and mems can be restored to + their original values after a removal-addition + event sequence. + 0: default value, cpuset v1 keeps legacy behavior. + 1: cpuset v1 behaves like cpuset v2. + cpcihp_generic= [HW,PCI] Generic port I/O CompactPCI driver Format: <first_slot>,<last_slot>,<port>,<enum_bit>[,<debug>]
kernel/cgroup/cpuset.c +33 -13
118 lines not on this page · raw message
Signature · 1 line
1.8.3.1
Quoted 11 lines · Waiman Long
Cpuset v2 has some valuable attributes that are not present in v1 because of backward compatibility concern. One of that is the restoration of the original cpu and memory node mask after a hot removal and addition event sequence.
This patch adds a new kernel command line option "cpuset_v2_mode=" to allow cpuset to have v2 behavior in a v1 cgroup when using a non-zero value. This enables users to optionally enable cpuset v2 behavior if they choose to.
Signed-off-by Waiman Long <[email protected]>
I have no strong objection. I have received quite a few requests for this in the past, and some were from other departments in my company.
Tejun Heo
maintainerHello, Waiman.
Documentation/admin-guide/kernel-parameters.txt line 677
Quoted 7 lines · Waiman Long
Documentation/admin-guide/kernel-parameters.txt +7
-0+ cpuset_v2_mode= [KNL] Enable cpuset v2 behavior in cpuset v1 cgroups. + In v2 mode, the cpus and mems can be restored to + their original values after a removal-addition + event sequence. + 0: default value, cpuset v1 keeps legacy behavior. + 1: cpuset v1 behaves like cpuset v2. +
It feels weird to make this a kernel boot param when all other options are specified on mount time. Is there a reason why this can't be a mount option too?
Thanks.
Signature · 1 line
tejun
Waiman Long
maintainerQuoted 14 lines · Tejun Heo
Hello, Waiman.
Documentation/admin-guide/kernel-parameters.txt line 677
Quoted 7 lines · Waiman Long
Documentation/admin-guide/kernel-parameters.txt +7
-0+ cpuset_v2_mode= [KNL] Enable cpuset v2 behavior in cpuset v1 cgroups. + In v2 mode, the cpus and mems can be restored to + their original values after a removal-addition + event sequence. + 0: default value, cpuset v1 keeps legacy behavior. + 1: cpuset v1 behaves like cpuset v2. +It feels weird to make this a kernel boot param when all other options are specified on mount time. Is there a reason why this can't be a mount option too?
Quoted 2 lines
Thanks.
Yes, we can certainly make this a mount option instead of a boot time parameter. BTW, where do we usually document the mount options for cgroup?
Cheers,
Longman
Tejun Heo
maintainerHello,
Quoted 6 lines · Waiman Long
Quoted 4 lines
It feels weird to make this a kernel boot param when all other options are specified on mount time. Is there a reason why this can't be a mount option too?
Yes, we can certainly make this a mount option instead of a boot time parameter. BTW, where do we usually document the mount options for cgroup?
I don't think there's a central place. Each controller documents theirs in their own file.
Thanks.
Signature · 1 line
tejun
Waiman Long
maintainerQuoted 7 lines · Tejun Heo
Hello,
Quoted 4 lines · Waiman Long
Quoted 4 lines
It feels weird to make this a kernel boot param when all other options are specified on mount time. Is there a reason why this can't be a mount option too?
Quoted 7 lines
Quoted 2 lines
Yes, we can certainly make this a mount option instead of a boot time parameter. BTW, where do we usually document the mount options for cgroup?
I don't think there's a central place. Each controller documents theirs in their own file.
Thanks.
OK, I am going to update the patch by controlling cpuset behavior by mount option instead.
Thanks,
Longman
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Waiman-Long/cpuset-Allow-v2-behavior-in-v1-cgroup/20170818-040416 config: i386-randconfig-n0-201733 (attached as .config) compiler: gcc-4.8 (Debian…
Hi Waiman,
[auto build test WARNING on linus/master]
[also build test WARNING on v4.13-rc5 next-20170817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Waiman-Long/cpuset-Allow-v2-behavior-in-v1-cgroup/20170818-040416
config: i386-randconfig-n0-201733 (attached as .config)
compiler: gcc-4.8 (Debian 4.8.4-1) 4.8.4 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 All warnings (new ones prefixed by >>):
kernel/cgroup/cpuset.c: In function 'set_v2_mode':
>> kernel/cgroup/cpuset.c:2145:2: warning: passing argument 3 of 'kstrtol' from incompatible pointer type [enabled by default]
ret = kstrtol(str, 0, &val);
^ In file included from include/linux/list.h:8:0,
from include/linux/kobject.h:20,
from include/linux/device.h:17,
from include/linux/node.h:17,
from include/linux/cpu.h:16,
from kernel/cgroup/cpuset.c:25:
include/linux/kernel.h:332:32: note: expected 'long int *' but argument is of type 'ssize_t *'
static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
^
vim +/kstrtol +2145 kernel/cgroup/cpuset.c
2138
2139 static int __init set_v2_mode(char *str)
2140 {
2141 ssize_t ret, val;
2142
2143 if (!str)
2144 return 0;
> 2145 ret = kstrtol(str, 0, &val);
2146 cpuset_v2_mode = !!val;
2147 return ret;
2148 }
2149 __setup("cpuset_v2_mode=", set_v2_mode);
2150
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Waiman-Long/cpuset-Allow-v2-behavior-in-v1-cgroup/20170818-040416 config: i386-defconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0…
Hi Waiman,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.13-rc5 next-20170817]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Waiman-Long/cpuset-Allow-v2-behavior-in-v1-cgroup/20170818-040416
config: i386-defconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce:
# save the attached .config to linux build tree
make ARCH=i386 All errors (new ones prefixed by >>):
kernel/cgroup/cpuset.c: In function 'set_v2_mode':
>> kernel/cgroup/cpuset.c:2145:24: error: passing argument 3 of 'kstrtol' from incompatible pointer type [-Werror=incompatible-pointer-types]
ret = kstrtol(str, 0, &val);
^ In file included from include/linux/list.h:8:0,
from include/linux/kobject.h:20,
from include/linux/device.h:17,
from include/linux/node.h:17,
from include/linux/cpu.h:16,
from kernel/cgroup/cpuset.c:25:
include/linux/kernel.h:332:32: note: expected 'long int *' but argument is of type 'ssize_t * {aka int *}'
static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
^~~~~~~
cc1: some warnings being treated as errors
vim +/kstrtol +2145 kernel/cgroup/cpuset.c
2138
2139 static int __init set_v2_mode(char *str)
2140 {
2141 ssize_t ret, val;
2142
2143 if (!str)
2144 return 0;
> 2145 ret = kstrtol(str, 0, &val);
2146 cpuset_v2_mode = !!val;
2147 return ret;
2148 }
2149 __setup("cpuset_v2_mode=", set_v2_mode);
2150
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation