[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1978b29a34b.dbd6def8716427.2074630307673917130@linux.beauty>
Date: Fri, 20 Jun 2025 10:27:31 +0800
From: Li Chen <me@...ux.beauty>
To: "Thomas Gleixner" <tglx@...utronix.de>, "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
Gentle ping.
---- On Tue, 22 Apr 2025 16:47:18 +0800 Li Chen <me@...ux.beauty> wrote ---
> From: Li Chen <chenl311@...natelecom.cn>
>
> 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.
>
> 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
> cpu_smt_num_threads and not inserting SMT domain into x86_topology if SMT
> is not enabled.
>
> Signed-off-by: Li Chen <chenl311@...natelecom.cn>
> ---
>
> [RESEND] because I forgot to add any mailing list previously.
>
> arch/x86/kernel/smpboot.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> index d6cf1e23c2a3..da6192e1af12 100644
> --- a/arch/x86/kernel/smpboot.c
> +++ b/arch/x86/kernel/smpboot.c
> @@ -485,9 +485,11 @@ static void __init build_sched_topology(void)
> int i = 0;
>
> #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)
> + };
> + }
> #endif
> #ifdef CONFIG_SCHED_CLUSTER
> x86_topology[i++] = (struct sched_domain_topology_level){
> --
> 2.48.1
>
>
Regards,
Li
Powered by blists - more mailing lists