[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87msa2r018.ffs@tglx>
Date: Fri, 20 Jun 2025 15:54:27 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Li Chen <me@...ux.beauty>, Ingo Molnar <mingo@...hat.com>, Borislav
Petkov <bp@...en8.de>, Dave Hansen <dave.hansen@...ux.intel.com>, x86
<x86@...nel.org>, linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RESEND] x86/smpboot: avoid SMT domain attach/destroy if
SMT is not enabled
On Tue, Apr 22 2025 at 16:47, Li Chen wrote:
> Currently, the SMT domain is added into sched_domain_topology
> by default if CONFIG_SCHED_SMT is enabled.
>
> If cpu_attach_domain finds that the CPU SMT domain’s cpumask_weight
> is just 1, it will destroy_sched_domain it.
If cpu_attach_domain() ..., it will destroy it.
> On a large machine, such as one with 512 cores, this results in
> 512 redundant domain attach/destroy operations.
>
> We can avoid these unnecessary operations by simply checking
s/We can avoid/Avoid/
> cpu_smt_num_threads and not inserting SMT domain into x86_topology if SMT
the SMT domain
> is not enabled.
>
> #ifdef CONFIG_SCHED_SMT
> - x86_topology[i++] = (struct sched_domain_topology_level){
> - cpu_smt_mask, cpu_smt_flags, SD_INIT_NAME(SMT)
> - };
> + if (cpu_smt_num_threads > 1) {
> + x86_topology[i++] = (struct sched_domain_topology_level){
> + cpu_smt_mask, cpu_smt_flags, SD_INIT_NAME(SMT)
> + };
> + }
Looks about right, though I really detest this coding style. I'm not
blaming you, as you just followed the already existing bad taste...
Thanks,
tglx
Powered by blists - more mailing lists