lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 16 Aug 2016 14:24:02 +0200
From:	Vincent Guittot <vincent.guittot@...aro.org>
To:	Dietmar Eggemann <dietmar.eggemann@....com>
Cc:	Morten Rasmussen <morten.rasmussen@....com>,
	Peter Zijlstra <peterz@...radead.org>,
	"mingo@...hat.com" <mingo@...hat.com>,
	Yuyang Du <yuyang.du@...el.com>, mgalbraith@...e.de,
	Sai Charan Gurrappadi <sgurrappadi@...dia.com>,
	freedom.tan@...iatek.com, keita.kobayashi.ym@...esas.com,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 08/13] sched: Store maximum per-cpu capacity in root domain

On 1 August 2016 at 20:53, Dietmar Eggemann <dietmar.eggemann@....com> wrote:
> On 25/07/16 14:34, Morten Rasmussen wrote:
>
> [...]
>
>> @@ -6923,11 +6924,22 @@ 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);
>> +
>> +             /* Use READ_ONCE/WRITE_ONCE to avoid load/store tearing */
>> +             if (rq->cpu_capacity_orig > READ_ONCE(rq->rd->max_cpu_capacity))
>> +                     WRITE_ONCE(rq->rd->max_cpu_capacity, rq->cpu_capacity_orig);
>
> We have to use d.rd rather rq->rd here since from v3 on we have this if
> condition in front of the cpu_attach_domain() call which replaces
> rq->rd with d.rd. Fixed patch below.
>
>> +
>>               cpu_attach_domain(sd, d.rd, i);
>>       }
>>       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);
>
> [...]
>
> -- >8 --
>
> From: Dietmar Eggemann <dietmar.eggemann@....com>
>
> 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.
>
> The max per-cpu capacity should be 1024 for all systems except SMT,
> where the capacity is currently based on smt_gain and the number of
> hardware threads and is <1024. If SMT can be brought to work with a
> per-thread capacity of 1024, this patch can be dropped and replaced by a
> hard-coded max capacity of 1024 (=SCHED_CAPACITY_SCALE).

FWIW, Acked-by: Vincent Guittot <vincent.guittot@...aro.org>

>
> cc: Ingo Molnar <mingo@...hat.com>
> cc: Peter Zijlstra <peterz@...radead.org>
>
> Signed-off-by: Dietmar Eggemann <dietmar.eggemann@....com>
> Signed-off-by: Morten Rasmussen <morten.rasmussen@....com>
> ---
>  kernel/sched/core.c  | 12 ++++++++++++
>  kernel/sched/sched.h |  2 ++
>  2 files changed, 14 insertions(+)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index a0a74b2d9f41..db03e6226d54 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -6873,6 +6873,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);
> @@ -6923,11 +6924,22 @@ 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);
> +
> +               /* Use READ_ONCE/WRITE_ONCE to avoid load/store tearing */
> +               if (rq->cpu_capacity_orig > READ_ONCE(d.rd->max_cpu_capacity))
> +                       WRITE_ONCE(d.rd->max_cpu_capacity, rq->cpu_capacity_orig);
> +
>                 cpu_attach_domain(sd, d.rd, i);
>         }
>         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 f44da95c70cd..444d8f38743f 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -565,6 +565,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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ