[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1965cae22a0.12ab5a70c833868.7155412488566097801@linux.beauty>
Date: Tue, 22 Apr 2025 16:47:18 +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: [PATCH RESEND] x86/smpboot: avoid SMT domain attach/destroy if SMT
is not enabled
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
Powered by blists - more mailing lists