[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191206123254.GH2844@hirez.programming.kicks-ass.net>
Date: Fri, 6 Dec 2019 13:32:54 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Valentin Schneider <valentin.schneider@....com>
Cc: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
Ingo Molnar <mingo@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Mel Gorman <mgorman@...hsingularity.net>,
Rik van Riel <riel@...riel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH] sched/fair: Optimize select_idle_core
On Fri, Dec 06, 2019 at 12:00:00PM +0000, Valentin Schneider wrote:
> Say you have a 4-core SMT2 system with the usual numbering scheme:
>
> {0, 4} {1, 5} {2, 6} {3, 7}
> CORE0 CORE1 CORE2 CORE3
>
>
> Say 'target' is the prev_cpu, in that case let's pick 5. Because we do a
> for_each_cpu_wrap(), our iteration for 'core' would start with
>
> 5, 6, 7, ...
>
> So say CORE2 is entirely idle and CORE1 isn't, we would go through the
> inner loop on CORE1 (with 'core' == 5), then go through CORE2 (with
> 'core' == 6) and return 'core'. I find it a bit unusual that we wouldn't
> return the first CPU in the SMT mask, usually we try to fill sched_groups
> in cpumask order.
>
>
> If we could have 'cpus' start with only primary CPUs, that would simplify
> things methinks:
>
> for_each_cpu_wrap(core, cpus, target) {
> bool idle = true;
>
> for_each_cpu(cpu, cpu_smt_mask(core)) {
> if (!available_idle_cpu(cpu)) {
> idle = false;
> break;
> }
>
> __cpumask_clear_cpu(core, cpus);
>
> if (idle)
> return core;
>
>
> Food for thought;
See here:
https://lkml.kernel.org/r/20180530142236.667774973@infradead.org
Powered by blists - more mailing lists