The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Li Chen <me@linux.beauty>, Ingo Molnar <mingo@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>, x86 <x86@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND] x86/smpboot: avoid SMT domain attach/destroy if SMT is not enabled
Date: Fri, 20 Jun 2025 15:54:27 +0200	[thread overview]
Message-ID: <87msa2r018.ffs@tglx> (raw)
In-Reply-To: <1965cae22a0.12ab5a70c833868.7155412488566097801@linux.beauty>

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

  parent reply	other threads:[~2025-06-20 13:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-22  8:47 [PATCH RESEND] x86/smpboot: avoid SMT domain attach/destroy if SMT is not enabled Li Chen
2025-06-20  2:27 ` Li Chen
2025-06-20 13:54 ` Thomas Gleixner [this message]
2025-06-20 15:47   ` [PATCH] x86/smpboot: Decrapify build_sched_topology() Thomas Gleixner
2025-06-24  9:00   ` [PATCH RESEND] x86/smpboot: avoid SMT domain attach/destroy if SMT is not enabled Li Chen

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=87msa2r018.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=me@linux.beauty \
    --cc=mingo@redhat.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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