From: Li Chen <me@linux.beauty>
To: "Thomas Gleixner" <tglx@linutronix.de>,
"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 10:27:31 +0800 [thread overview]
Message-ID: <1978b29a34b.dbd6def8716427.2074630307673917130@linux.beauty> (raw)
In-Reply-To: <1965cae22a0.12ab5a70c833868.7155412488566097801@linux.beauty>
Gentle ping.
---- On Tue, 22 Apr 2025 16:47:18 +0800 Li Chen <me@linux.beauty> wrote ---
> From: Li Chen <chenl311@chinatelecom.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@chinatelecom.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
next prev parent reply other threads:[~2025-06-20 2:28 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-22 8:47 Li Chen
2025-06-20 2:27 ` Li Chen [this message]
2025-06-20 13:54 ` Thomas Gleixner
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=1978b29a34b.dbd6def8716427.2074630307673917130@linux.beauty \
--to=me@linux.beauty \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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
all inboxes | Powered by JetHome®