signals: s/siginitset/sigemptyset/ in do_sigtimedwait()
[firefly-linux-kernel-4.4.55.git] / kernel / cpuset.c
index 3d54c418bd060453ce8a61442f1300c690bf535c..130017843899200d47958589bf4ab394eb857c4f 100644 (file)
 #include <linux/cgroup.h>
 #include <linux/wait.h>
 
-/*
- * Tracks how many cpusets are currently defined in system.
- * When there is only one cpuset (the root cpuset) we can
- * short circuit some hooks.
- */
-int number_of_cpusets __read_mostly;
+struct static_key cpusets_enabled_key __read_mostly = STATIC_KEY_INIT_FALSE;
 
 /* See "Frequency meter" comments, below. */
 
@@ -611,7 +606,7 @@ static int generate_sched_domains(cpumask_var_t **domains,
                goto done;
        }
 
-       csa = kmalloc(number_of_cpusets * sizeof(cp), GFP_KERNEL);
+       csa = kmalloc(nr_cpusets() * sizeof(cp), GFP_KERNEL);
        if (!csa)
                goto done;
        csn = 0;
@@ -1888,7 +1883,7 @@ static int cpuset_css_online(struct cgroup_subsys_state *css)
        if (is_spread_slab(parent))
                set_bit(CS_SPREAD_SLAB, &cs->flags);
 
-       number_of_cpusets++;
+       cpuset_inc();
 
        if (!test_bit(CGRP_CPUSET_CLONE_CHILDREN, &css->cgroup->flags))
                goto out_unlock;
@@ -1939,7 +1934,7 @@ static void cpuset_css_offline(struct cgroup_subsys_state *css)
        if (is_sched_load_balance(cs))
                update_flag(CS_SCHED_LOAD_BALANCE, cs, 0);
 
-       number_of_cpusets--;
+       cpuset_dec();
        clear_bit(CS_ONLINE, &cs->flags);
 
        mutex_unlock(&cpuset_mutex);
@@ -1992,7 +1987,6 @@ int __init cpuset_init(void)
        if (!alloc_cpumask_var(&cpus_attach, GFP_KERNEL))
                BUG();
 
-       number_of_cpusets = 1;
        return 0;
 }