[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250625083020.GB1613200@noisy.programming.kicks-ass.net>
Date: Wed, 25 Jun 2025 10:30:20 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: K Prateek Nayak <kprateek.nayak@....com>
Cc: Li Chen <me@...ux.beauty>, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
"H . Peter Anvin" <hpa@...or.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
Sohil Mehta <sohil.mehta@...el.com>,
Brian Gerst <brgerst@...il.com>,
Patryk Wlazlyn <patryk.wlazlyn@...ux.intel.com>,
linux-kernel@...r.kernel.org,
"Gautham R. Shenoy" <gautham.shenoy@....com>,
Li Chen <chenl311@...natelecom.cn>
Subject: Re: [PATCH v3 2/2] x86/smpboot: avoid SMT domain attach/destroy if
SMT is not enabled
On Wed, Jun 25, 2025 at 11:15:22AM +0530, K Prateek Nayak wrote:
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index 3818b16c19e1..1793248d28cd 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -494,6 +494,8 @@ static struct sched_domain_topology_level x86_topology[] = {
> static void __init build_sched_topology(void)
> {
> + struct sched_domain_topology_level *topology = x86_topology;
> +
> /*
> * When there is NUMA topology inside the package invalidate the
> * PKG domain since the NUMA domains will auto-magically create the
> @@ -504,7 +506,15 @@ static void __init build_sched_topology(void)
> memset(&x86_topology[pkgdom], 0, sizeof(x86_topology[pkgdom]));
> }
> - set_sched_topology(x86_topology);
> +
> + /*
> + * Drop the SMT domains if there is only one thread per-core
> + * since it'll get degenerated by the scheduler anyways.
> + */
> + if (cpu_smt_num_threads <= 1)
> + ++topology;
> +
> + set_sched_topology(topology);
> }
> void set_cpu_sibling_map(int cpu)
Yes, that is far saner.
Powered by blists - more mailing lists