Re: [PATCH v2 06/13] sched: Store maximum per-cpu capacity in root domain
From: Vincent Guittot
Date: Wed Jul 13 2016 - 08:40:52 EST
On 22 June 2016 at 19:03, Morten Rasmussen <morten.rasmussen@xxxxxxx> wrote:
> From: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
>
> To be able to compare the capacity of the target cpu with the highest
> available cpu capacity, store the maximum per-cpu capacity in the root
> domain.
I thought that the capacity of all CPUS were built so the highest
capacity of the CPU of the system is 1024 for big LITTLE system . So
this patch doesn't seem necessary for big.LITTLE system
>
> cc: Ingo Molnar <mingo@xxxxxxxxxx>
> cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
>
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
> Signed-off-by: Morten Rasmussen <morten.rasmussen@xxxxxxx>
> ---
> kernel/sched/core.c | 9 +++++++++
> kernel/sched/sched.h | 2 ++
> 2 files changed, 11 insertions(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index fe39118ffdfb..5093765e9930 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6855,6 +6855,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);
> @@ -6905,11 +6906,19 @@ 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("span: %*pbl (max cpu_capacity = %lu)\n",
> + cpumask_pr_args(cpu_map), rq->rd->max_cpu_capacity);
> +
> ret = 0;
> error:
> __free_domain_allocs(&d, alloc_state, cpu_map);
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 72f1f3087b04..3e9904ef224f 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -564,6 +564,8 @@ struct root_domain {
> */
> cpumask_var_t rto_mask;
> struct cpupri cpupri;
> +
> + unsigned long max_cpu_capacity;
> };
>
> extern struct root_domain def_root_domain;
> --
> 1.9.1
>