[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPM31RKTZYsZ6V6qjBNwZfE0i0Tk3fgeH_rxnDoG=pM24-TG_g@mail.gmail.com>
Date: Sat, 24 Aug 2013 03:33:59 -0700
From: Paul Turner <pjt@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
LKML <linux-kernel@...r.kernel.org>,
Mike Galbraith <efault@....de>, Alex Shi <alex.shi@...el.com>,
Preeti U Murthy <preeti@...ux.vnet.ibm.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Morten Rasmussen <morten.rasmussen@....com>,
Namhyung Kim <namhyung@...nel.org>,
Lei Wen <leiwen@...vell.com>, Rik van Riel <riel@...riel.com>,
Joonsoo Kim <js1304@...il.com>
Subject: Re: [PATCH 07/10] sched, fair: Optimize find_busiest_queue()
On Mon, Aug 19, 2013 at 9:01 AM, Peter Zijlstra <peterz@...radead.org> wrote:
> Use for_each_cpu_and() and thereby avoid computing the capacity for
> CPUs we know we're not interested in.
>
> Signed-off-by: Peter Zijlstra <peterz@...radead.org>
> ---
> kernel/sched/fair.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4977,7 +4977,7 @@ static struct rq *find_busiest_queue(str
> unsigned long busiest_load = 0, busiest_power = SCHED_POWER_SCALE;
> int i;
>
> - for_each_cpu(i, sched_group_cpus(group)) {
> + for_each_cpu_and(i, sched_group_cpus(group), env->cpus) {
> unsigned long power = power_of(i);
> unsigned long capacity = DIV_ROUND_CLOSEST(power,
> SCHED_POWER_SCALE);
> @@ -4986,9 +4986,6 @@ static struct rq *find_busiest_queue(str
> if (!capacity)
> capacity = fix_small_capacity(env->sd, group);
>
> - if (!cpumask_test_cpu(i, env->cpus))
> - continue;
> -
> rq = cpu_rq(i);
> wl = weighted_cpuload(i);
There's no need to actually do the divisions immediately below this also.
e.g.
unsigned long max_load_power = SCHED_POWER_SCALE;
...
if (wl * max_load_power > max_load * power) {
max_load = wl;
max_load_power = power;
...
This would actually end up being a little more accurate even.
[ Alternatively without caching max_load_power we could compare wl *
power vs max_load * SCHED_POWER_SCALE. ]
Reviewed-by: Paul Turner <pjt@...gle.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists