cgroup/cpuset: no need to explicitly init a global static variable
Subsystems (2)
PATCH 1/1 cgroup/cpuset: no need to explicitly init a global static variable
cpuset_rwsem is a static variable. It's initialized at build time and so there's no need for explicit runtime init leaking one percpu int.
--- kernel/cgroup/cpuset.c | 2 -- 1 file changed, 2 deletions(-)
kernel/cgroup/cpuset.c +0 -2
@@ -3281,8 +3281,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = {int __init cpuset_init (void ) { -BUG_ON (percpu_init_rwsem (&cpuset_rwsem)); -BUG_ON (!alloc_cpumask_var (&top_cpuset.cpus_allowed,GFP_KERNEL ));BUG_ON (!alloc_cpumask_var (&top_cpuset.effective_cpus,GFP_KERNEL ));BUG_ON (!zalloc_cpumask_var (&top_cpuset.subparts_cpus,GFP_KERNEL ));
Signature · 1 line
2.38.1
Waiman Long
maintainerQuoted 13 lines · Daniel Vacek
cpuset_rwsemis a static variable. It's initialized at build time and so there's no need for explicit runtime init leaking one percpu int.Signed-off-by Daniel Vacek <[email protected]>--- kernel/cgroup/cpuset.c | 2 -- 1 file changed, 2 deletions(-)kernel/cgroup/cpuset.c +0
-0
kernel/cgroup/cpuset.c struct cgroup_subsys cpuset_cgrp_subsys = { · line 3286
Quoted 8 lines
kernel/cgroup/cpuset.c +0
-2@@ -3281,8 +3281,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = {int __init cpuset_init (void ) { -BUG_ON (percpu_init_rwsem (&cpuset_rwsem)); -BUG_ON (!alloc_cpumask_var (&top_cpuset.cpus_allowed,GFP_KERNEL ));BUG_ON (!alloc_cpumask_var (&top_cpuset.effective_cpus,GFP_KERNEL ));BUG_ON (!zalloc_cpumask_var (&top_cpuset.subparts_cpus,GFP_KERNEL ));
It will be clearer if you mention that DEFINE_STATIC_PERCPU_RWSEM() is used to set up cpuset_rwsem at build time. Other than that, the patch looks good to me.
Cheers,
Longman
Quoted 8 lines · Waiman Long
Quoted 2 lines · Daniel Vacek
cpuset_rwsemis a static variable. It's initialized at build time and so there's no need for explicit runtime init leaking one percpu int.It will be clearer if you mention that
DEFINE_STATIC_PERCPU_RWSEM()is used to set upcpuset_rwsemat build time. Other than that, the patch looks good to me.
That's true. I only figured later.
Whoever is going to apply it, feel free to amend the message if you like.
--nX
Quoted 3 lines
Cheers,
Longman
Quoted 23 lines · Daniel Vacek
cpuset_rwsemis a static variable. It's initialized at build time and so there's no need for explicit runtime init leaking one percpu int.Signed-off-by Daniel Vacek <[email protected]>--- kernel/cgroup/cpuset.c | 2 -- 1 file changed, 2 deletions(-)kernel/cgroup/cpuset.c +0
-2@@ -3281,8 +3281,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = {int __init cpuset_init (void ) { -BUG_ON (percpu_init_rwsem (&cpuset_rwsem)); -BUG_ON (!alloc_cpumask_var (&top_cpuset.cpus_allowed,GFP_KERNEL ));BUG_ON (!alloc_cpumask_var (&top_cpuset.effective_cpus,GFP_KERNEL ));BUG_ON (!zalloc_cpumask_var (&top_cpuset.subparts_cpus,GFP_KERNEL ));Signature · 1 line
2.38.1
Good catch.
Signature · 1 line
Aaron Tomlin
Hi,
Quoted 13 lines · Daniel Vacek
cpuset_rwsemis a static variable. It's initialized at build time and so there's no need for explicit runtime init leaking one percpu int.Signed-off-by Daniel Vacek <[email protected]>--- kernel/cgroup/cpuset.c | 2 -- 1 file changed, 2 deletions(-)kernel/cgroup/cpuset.c +0
-0
kernel/cgroup/cpuset.c struct cgroup_subsys cpuset_cgrp_subsys = { · line 3286
Quoted 8 lines
kernel/cgroup/cpuset.c +0
-2@@ -3281,8 +3281,6 @@ struct cgroup_subsys cpuset_cgrp_subsys = {int __init cpuset_init (void ) { -BUG_ON (percpu_init_rwsem (&cpuset_rwsem)); -BUG_ON (!alloc_cpumask_var (&top_cpuset.cpus_allowed,GFP_KERNEL ));BUG_ON (!alloc_cpumask_var (&top_cpuset.effective_cpus,GFP_KERNEL ));BUG_ON (!zalloc_cpumask_var (&top_cpuset.subparts_cpus,GFP_KERNEL ));
-Mukesh
Quoted 4 lines · Daniel Vacek
cpuset_rwsemis a static variable. It's initialized at build time and so there's no need for explicit runtime init leaking one percpu int.Signed-off-by Daniel Vacek <[email protected]>
Applied to cgroup/for-6.2-fixes with the following description:
cgroup/cpuset: no need to explicitly init a global static variable
cpuset_rwsem is a static variable defined with DEFINE_STATIC_PERCPU_RWSEM(). It's initialized at build time and so there's no need for explicit runtime init leaking one percpu int.
Thanks.
Signature · 1 line
tejun