sched: Store system-wide maximum cpu capacity in root domain
authorDietmar Eggemann <dietmar.eggemann@arm.com>
Thu, 7 May 2015 17:46:15 +0000 (18:46 +0100)
committerPunit Agrawal <punit.agrawal@arm.com>
Mon, 21 Mar 2016 12:34:30 +0000 (12:34 +0000)
To be able to compare the capacity of the target cpu with the highest
cpu capacity of the system in the wakeup path, store the system-wide
maximum cpu capacity in the root domain.

cc: Ingo Molnar <mingo@redhat.com>
cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
kernel/sched/core.c
kernel/sched/sched.h

index eb70592f03f624fca69b2d0317f4a0cf1d52e940..879bdffc928be26024e5e9b079c7178bc501789e 100644 (file)
@@ -6971,6 +6971,7 @@ static int build_sched_domains(const struct cpumask *cpu_map,
        enum s_alloc alloc_state;
        struct sched_domain *sd;
        struct s_data d;
+       struct rq *rq = NULL;
        int i, ret = -ENOMEM;
 
        alloc_state = __visit_domain_allocation_hell(&d, cpu_map);
@@ -7021,11 +7022,18 @@ static int build_sched_domains(const struct cpumask *cpu_map,
        /* Attach the domains */
        rcu_read_lock();
        for_each_cpu(i, cpu_map) {
+               rq = cpu_rq(i);
                sd = *per_cpu_ptr(d.sd, i);
                cpu_attach_domain(sd, d.rd, i);
+
+               if (rq->cpu_capacity_orig > rq->rd->max_cpu_capacity)
+                       rq->rd->max_cpu_capacity = rq->cpu_capacity_orig;
        }
        rcu_read_unlock();
 
+       if (rq)
+               pr_info("max cpu_capacity %lu\n", rq->rd->max_cpu_capacity);
+
        ret = 0;
 error:
        __free_domain_allocs(&d, alloc_state, cpu_map);
index b242775bf670e116233862c590915e06132485ca..2b7ffa5a20ad4836efa2ecb812fb05f50f1355d3 100644 (file)
@@ -543,6 +543,9 @@ struct root_domain {
         */
        cpumask_var_t rto_mask;
        struct cpupri cpupri;
+
+       /* Maximum cpu capacity in the system. */
+       unsigned long max_cpu_capacity;
 };
 
 extern struct root_domain def_root_domain;