aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpuset.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 3d54c418bd06..130017843899 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -61,12 +61,7 @@
61#include <linux/cgroup.h> 61#include <linux/cgroup.h>
62#include <linux/wait.h> 62#include <linux/wait.h>
63 63
64/* 64struct static_key cpusets_enabled_key __read_mostly = STATIC_KEY_INIT_FALSE;
65 * Tracks how many cpusets are currently defined in system.
66 * When there is only one cpuset (the root cpuset) we can
67 * short circuit some hooks.
68 */
69int number_of_cpusets __read_mostly;
70 65
71/* See "Frequency meter" comments, below. */ 66/* See "Frequency meter" comments, below. */
72 67
@@ -611,7 +606,7 @@ static int generate_sched_domains(cpumask_var_t **domains,
611 goto done; 606 goto done;
612 } 607 }
613 608
614 csa = kmalloc(number_of_cpusets * sizeof(cp), GFP_KERNEL); 609 csa = kmalloc(nr_cpusets() * sizeof(cp), GFP_KERNEL);
615 if (!csa) 610 if (!csa)
616 goto done; 611 goto done;
617 csn = 0; 612 csn = 0;
@@ -1888,7 +1883,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
1888 if (is_spread_slab(parent)) 1883 if (is_spread_slab(parent))
1889 set_bit(CS_SPREAD_SLAB, &cs->flags); 1884 set_bit(CS_SPREAD_SLAB, &cs->flags);
1890 1885
1891 number_of_cpusets++; 1886 cpuset_inc();
1892 1887
1893 if (!test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags)) 1888 if (!test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags))
1894 goto out_unlock; 1889 goto out_unlock;
@@ -1939,7 +1934,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
1939 if (is_sched_load_balance(cs)) 1934 if (is_sched_load_balance(cs))
1940 update_flag(CS_SCHED_LOAD_BALANCE, cs, 0); 1935 update_flag(CS_SCHED_LOAD_BALANCE, cs, 0);
1941 1936
1942 number_of_cpusets--; 1937 cpuset_dec();
1943 clear_bit(CS_ONLINE, &cs->flags); 1938 clear_bit(CS_ONLINE, &cs->flags);
1944 1939
1945 mutex_unlock(&cpuset_mutex); 1940 mutex_unlock(&cpuset_mutex);
@@ -1992,7 +1987,6 @@ int __init cpuset_init(void)
1992 if (!alloc_cpumask_var(&cpus_attach, GFP_KERNEL)) 1987 if (!alloc_cpumask_var(&cpus_attach, GFP_KERNEL))
1993 BUG(); 1988 BUG();
1994 1989
1995 number_of_cpusets = 1;
1996 return 0; 1990 return 0;
1997} 1991}
1998 1992