]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - kernel/sched/core.c
Merge tag 'pinctrl-v4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux.git] / kernel / sched / core.c
index fd2fce8a001be7375d4064de04dab71ac7eab307..091e089063be1dc25ab1180fec3f99a4408fb024 100644 (file)
@@ -2880,6 +2880,18 @@ unsigned long long nr_context_switches(void)
        return sum;
 }
 
+/*
+ * Consumers of these two interfaces, like for example the cpuidle menu
+ * governor, are using nonsensical data. Preferring shallow idle state selection
+ * for a CPU that has IO-wait which might not even end up running the task when
+ * it does become runnable.
+ */
+
+unsigned long nr_iowait_cpu(int cpu)
+{
+       return atomic_read(&cpu_rq(cpu)->nr_iowait);
+}
+
 /*
  * IO-wait accounting, and how its mostly bollocks (on SMP).
  *
@@ -2915,31 +2927,11 @@ unsigned long nr_iowait(void)
        unsigned long i, sum = 0;
 
        for_each_possible_cpu(i)
-               sum += atomic_read(&cpu_rq(i)->nr_iowait);
+               sum += nr_iowait_cpu(i);
 
        return sum;
 }
 
-/*
- * Consumers of these two interfaces, like for example the cpuidle menu
- * governor, are using nonsensical data. Preferring shallow idle state selection
- * for a CPU that has IO-wait which might not even end up running the task when
- * it does become runnable.
- */
-
-unsigned long nr_iowait_cpu(int cpu)
-{
-       struct rq *this = cpu_rq(cpu);
-       return atomic_read(&this->nr_iowait);
-}
-
-void get_iowait_load(unsigned long *nr_waiters, unsigned long *load)
-{
-       struct rq *rq = this_rq();
-       *nr_waiters = atomic_read(&rq->nr_iowait);
-       *load = rq->load.weight;
-}
-
 #ifdef CONFIG_SMP
 
 /*
@@ -5859,11 +5851,14 @@ void __init sched_init_smp(void)
        /*
         * There's no userspace yet to cause hotplug operations; hence all the
         * CPU masks are stable and all blatant races in the below code cannot
-        * happen.
+        * happen. The hotplug lock is nevertheless taken to satisfy lockdep,
+        * but there won't be any contention on it.
         */
+       cpus_read_lock();
        mutex_lock(&sched_domains_mutex);
        sched_init_domains(cpu_active_mask);
        mutex_unlock(&sched_domains_mutex);
+       cpus_read_unlock();
 
        /* Move init over to a non-isolated CPU */
        if (set_cpus_allowed_ptr(current, housekeeping_cpumask(HK_FLAG_DOMAIN)) < 0)