[PATCH v3 0/2] x86/smpboot: tidy sched-topology and drop useless SMT level

Li Chen posted 2 patches 3 months, 2 weeks ago
There is a newer version of this series
arch/x86/kernel/smpboot.c | 59 +++++++++++++++++++++------------------
1 file changed, 32 insertions(+), 27 deletions(-)
[PATCH v3 0/2] x86/smpboot: tidy sched-topology and drop useless SMT level
Posted by Li Chen 3 months, 2 weeks ago
From: Li Chen <chenl311@chinatelecom.cn>

This two–patch series cleans up sched-domain topology handling and
eliminates hundreds of pointless attach/destroy cycles for large
machines when SMT is not available.

Patch 1 (from Thomas, unchanged) gets rid of the #ifdef maze in
build_sched_topology() by statically initialising the topology array.

Patch 2 (mine) is a follow-up that simply memmoves the array when
cpu_smt_num_threads <= 1, so the SMT level never gets created and
immediately torn down again.

Tested on Qemu.

changelog:
v2: fix wording issue as suggested by Thomas [1]
v3: remove pointless memset and adjust PKG index accordingly, as
    suggested by Thomas [2], and refine some other wording issues.

[1]: https://lore.kernel.org/all/87msa2r018.ffs@tglx/
[2]: https://lore.kernel.org/all/875xglntx1.ffs@tglx/

Li Chen (1):
  x86/smpboot: avoid SMT domain attach/destroy if SMT is not enabled

Thomas Gleixner (1):
  x86/smpboot: Decrapify build_sched_topology()

 arch/x86/kernel/smpboot.c | 59 +++++++++++++++++++++------------------
 1 file changed, 32 insertions(+), 27 deletions(-)

-- 
2.49.0

Re: [PATCH v3 0/2] x86/smpboot: tidy sched-topology and drop useless SMT level
Posted by K Prateek Nayak 3 months, 2 weeks ago
Hello Li,

On 6/25/2025 9:15 AM, Li Chen wrote:
> From: Li Chen <chenl311@chinatelecom.cn>
> 
> This two–patch series cleans up sched-domain topology handling and
> eliminates hundreds of pointless attach/destroy cycles for large
> machines when SMT is not available.
> 
> Patch 1 (from Thomas, unchanged) gets rid of the #ifdef maze in
> build_sched_topology() by statically initialising the topology array.
> 
> Patch 2 (mine) is a follow-up that simply memmoves the array when
> cpu_smt_num_threads <= 1, so the SMT level never gets created and
> immediately torn down again.
> 
> Tested on Qemu.

I think there is a simpler approach to Patch 2 but other than that
I gave this series a spin during my review with different topology
on QEMU and didn't find any surprises. I tested with and without
the "threads" parameter to "-smp" and also with "nosmt" kernel
cmdline and everything seemed to be in order. Feel free to add:

Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>

> 
> changelog:
> v2: fix wording issue as suggested by Thomas [1]
> v3: remove pointless memset and adjust PKG index accordingly, as
>      suggested by Thomas [2], and refine some other wording issues.
> 
> [1]: https://lore.kernel.org/all/87msa2r018.ffs@tglx/
> [2]: https://lore.kernel.org/all/875xglntx1.ffs@tglx/
> 
> Li Chen (1):
>    x86/smpboot: avoid SMT domain attach/destroy if SMT is not enabled
> 
> Thomas Gleixner (1):
>    x86/smpboot: Decrapify build_sched_topology()
> 
>   arch/x86/kernel/smpboot.c | 59 +++++++++++++++++++++------------------
>   1 file changed, 32 insertions(+), 27 deletions(-)
> 

-- 
Thanks and Regards,
Prateek