From: Peter Zijlstra <peterz@infradead•org>
To: Yury Norov <yury.norov@gmail•com>
Cc: linux-kernel@vger•kernel.org,
Alexander Lobakin <alexandr.lobakin@intel•com>,
Alexei Starovoitov <ast@kernel•org>,
Alexey Klimov <aklimov@redhat•com>,
Andrew Morton <akpm@linux-foundation•org>,
Andrii Nakryiko <andrii@kernel•org>,
Andy Shevchenko <andriy.shevchenko@linux•intel.com>,
Ben Segall <bsegall@google•com>, Christoph Lameter <cl@linux•com>,
Dan Williams <dan.j.williams@intel•com>,
Daniel Borkmann <daniel@iogearbox•net>,
Daniel Bristot de Oliveira <bristot@redhat•com>,
Dennis Zhou <dennis@kernel•org>,
Dietmar Eggemann <dietmar.eggemann@arm•com>,
Eric Dumazet <edumazet@google•com>,
Frederic Weisbecker <fweisbec@gmail•com>,
Guenter Roeck <linux@roeck-us•net>,
Ingo Molnar <mingo@redhat•com>,
Isabella Basso <isabbasso@riseup•net>,
John Fastabend <john.fastabend@gmail•com>,
Josh Poimboeuf <jpoimboe@kernel•org>,
Juergen Gross <jgross@suse•com>,
Juri Lelli <juri.lelli@redhat•com>, KP Singh <kpsingh@kernel•org>,
Kees Cook <keescook@chromium•org>,
Martin KaFai Lau <kafai@fb•com>, Mel Gorman <mgorman@suse•de>,
Miroslav Benes <mbenes@suse•cz>,
Nathan Chancellor <nathan@kernel•org>,
"Paul E . McKenney" <paulmck@kernel•org>,
Randy Dunlap <rdunlap@infradead•org>,
Rasmus Villemoes <linux@rasmusvillemoes•dk>,
Sebastian Andrzej Siewior <bigeasy@linutronix•de>,
Song Liu <songliubraving@fb•com>,
Steven Rostedt <rostedt@goodmis•org>, Tejun Heo <tj@kernel•org>,
Thomas Gleixner <tglx@linutronix•de>,
Valentin Schneider <vschneid@redhat•com>,
Vincent Guittot <vincent.guittot@linaro•org>,
Vlastimil Babka <vbabka@suse•cz>, Yonghong Song <yhs@fb•com>,
linux-mm@kvack•org, netdev@vger•kernel.org, bpf@vger•kernel.org
Subject: Re: [PATCH 15/16] sched/topology: optimize topology_span_sane()
Date: Mon, 18 Jul 2022 23:37:47 +0200 [thread overview]
Message-ID: <YtXSq3JyGLE4i8Gb@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20220718192844.1805158-16-yury.norov@gmail.com>
On Mon, Jul 18, 2022 at 12:28:43PM -0700, Yury Norov wrote:
> kernel/sched/topology.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 05b6c2ad90b9..ad32d0a43424 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -2211,6 +2211,8 @@ static struct sched_domain *build_sched_domain(struct sched_domain_topology_leve
> static bool topology_span_sane(struct sched_domain_topology_level *tl,
> const struct cpumask *cpu_map, int cpu)
> {
> + const struct cpumask *mc = tl->mask(cpu);
> + const struct cpumask *mi;
> int i;
>
> /* NUMA levels are allowed to overlap */
> @@ -2226,14 +2228,18 @@ static bool topology_span_sane(struct sched_domain_topology_level *tl,
> for_each_cpu(i, cpu_map) {
> if (i == cpu)
> continue;
> +
> + mi = tl->mask(i);
> + if (mi == mc)
> + continue;
> +
> /*
> * We should 'and' all those masks with 'cpu_map' to exactly
> * match the topology we're about to build, but that can only
> * remove CPUs, which only lessens our ability to detect
> * overlaps
> */
> - if (!cpumask_equal(tl->mask(cpu), tl->mask(i)) &&
> - cpumask_intersects(tl->mask(cpu), tl->mask(i)))
> + if (!cpumask_equal(mc, mi) && cpumask_intersects(mc, mi))
> return false;
> }
This is once again a super slow path; but I don't suppose you're making
the code worse in this case.
next prev parent reply other threads:[~2022-07-18 21:38 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-18 19:28 [PATCH 00/16] Introduce DEBUG_BITMAP config option and bitmap_check_params() Yury Norov
2022-07-18 19:28 ` [PATCH 01/16] lib/bitmap: add bitmap_check_params() Yury Norov
2022-07-18 21:01 ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 02/16] lib/bitmap: don't call bitmap_set() with len == 0 Yury Norov
2022-07-18 21:06 ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 03/16] lib/test_bitmap: don't test bitmap_set if nbits " Yury Norov
2022-07-18 21:08 ` Andy Shevchenko
2022-08-09 12:37 ` Rasmus Villemoes
2022-07-18 19:28 ` [PATCH 04/16] lib/test_bitmap: test test_bitmap_arr{32,64} starting from nbits == 1 Yury Norov
2022-07-18 21:09 ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 05/16] lib/test_bitmap: disable compile-time test if DEBUG_BITMAP() is enabled Yury Norov
2022-07-18 21:10 ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 06/16] lib/test_bitmap: delete meaningless test for bitmap_cut Yury Norov
2022-07-18 21:11 ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 07/16] smp: optimize smp_call_function_many_cond() Yury Norov
2022-07-18 21:26 ` Peter Zijlstra
2022-07-18 21:36 ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 08/16] smp: optimize smp_call_function_many_cond() for more Yury Norov
2022-07-18 21:29 ` Peter Zijlstra
2022-07-20 17:06 ` Yury Norov
2022-07-18 21:37 ` Andy Shevchenko
2022-07-18 19:28 ` [PATCH 09/16] irq: don't copy cpu affinity mask if source is equal to destination Yury Norov
2022-07-18 21:30 ` Peter Zijlstra
2022-07-18 19:28 ` [PATCH 10/16] sched: optimize __set_cpus_allowed_ptr_locked() Yury Norov
2022-07-18 21:34 ` Peter Zijlstra
2022-07-18 19:28 ` [PATCH 11/16] time: optimize tick_check_preferred() Yury Norov
2022-08-06 8:30 ` Thomas Gleixner
2022-08-08 11:42 ` Thomas Gleixner
2022-08-08 16:38 ` Yury Norov
2022-08-09 12:29 ` Rasmus Villemoes
2022-07-18 19:28 ` [PATCH 12/16] time: optimize tick_check_percpu() Yury Norov
2022-07-18 19:28 ` [PATCH 13/16] time: optimize tick_setup_device() Yury Norov
2022-07-18 21:35 ` Peter Zijlstra
2022-07-18 19:28 ` [PATCH 14/16] mm/percpu: optimize pcpu_alloc_area() Yury Norov
2022-07-19 4:25 ` Dennis Zhou
2022-07-18 19:28 ` [PATCH 15/16] sched/topology: optimize topology_span_sane() Yury Norov
2022-07-18 21:37 ` Peter Zijlstra [this message]
2022-07-18 19:28 ` [PATCH 16/16] lib: create CONFIG_DEBUG_BITMAP parameter Yury Norov
2022-07-18 21:39 ` Andy Shevchenko
2022-07-20 16:49 ` Yury Norov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YtXSq3JyGLE4i8Gb@worktop.programming.kicks-ass.net \
--to=peterz@infradead$(echo .)org \
--cc=aklimov@redhat$(echo .)com \
--cc=akpm@linux-foundation$(echo .)org \
--cc=alexandr.lobakin@intel$(echo .)com \
--cc=andrii@kernel$(echo .)org \
--cc=andriy.shevchenko@linux$(echo .)intel.com \
--cc=ast@kernel$(echo .)org \
--cc=bigeasy@linutronix$(echo .)de \
--cc=bpf@vger$(echo .)kernel.org \
--cc=bristot@redhat$(echo .)com \
--cc=bsegall@google$(echo .)com \
--cc=cl@linux$(echo .)com \
--cc=dan.j.williams@intel$(echo .)com \
--cc=daniel@iogearbox$(echo .)net \
--cc=dennis@kernel$(echo .)org \
--cc=dietmar.eggemann@arm$(echo .)com \
--cc=edumazet@google$(echo .)com \
--cc=fweisbec@gmail$(echo .)com \
--cc=isabbasso@riseup$(echo .)net \
--cc=jgross@suse$(echo .)com \
--cc=john.fastabend@gmail$(echo .)com \
--cc=jpoimboe@kernel$(echo .)org \
--cc=juri.lelli@redhat$(echo .)com \
--cc=kafai@fb$(echo .)com \
--cc=keescook@chromium$(echo .)org \
--cc=kpsingh@kernel$(echo .)org \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-mm@kvack$(echo .)org \
--cc=linux@rasmusvillemoes$(echo .)dk \
--cc=linux@roeck-us$(echo .)net \
--cc=mbenes@suse$(echo .)cz \
--cc=mgorman@suse$(echo .)de \
--cc=mingo@redhat$(echo .)com \
--cc=nathan@kernel$(echo .)org \
--cc=netdev@vger$(echo .)kernel.org \
--cc=paulmck@kernel$(echo .)org \
--cc=rdunlap@infradead$(echo .)org \
--cc=rostedt@goodmis$(echo .)org \
--cc=songliubraving@fb$(echo .)com \
--cc=tglx@linutronix$(echo .)de \
--cc=tj@kernel$(echo .)org \
--cc=vbabka@suse$(echo .)cz \
--cc=vincent.guittot@linaro$(echo .)org \
--cc=vschneid@redhat$(echo .)com \
--cc=yhs@fb$(echo .)com \
--cc=yury.norov@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox