mirror of
https://github.com/torvalds/linux.git
synced 2026-10-23 23:51:02 +02:00
sched/topology: Add asymmetric SMT packing override
Architectures can use SD_ASYM_PACKING to describe preferred CPU ordering at the SMT scheduling domain. Some systems benefit from this policy, but their firmware cannot describe the preference and inferring it from the CPU model would embed a platform-specific policy in the kernel. Add sched_smt_asym_packing=on boot option to force SD_ASYM_PACKING at the SMT level. Omitting the option preserves the topology provided by the architecture or firmware. Apply the override centrally to domains with SD_SHARE_CPUCAPACITY so it also covers architectures with custom SMT topology callbacks, including powerpc. When enabled, priority remains defined by arch_asym_cpu_priority(). The weak default prefers lower-numbered logical CPUs, while architecture overrides remain authoritative. Siblings with equal priorities remain unordered. In particular, x86 with CONFIG_SCHED_MC_PRIO normally gives both SMT siblings the same core priority, so enabling the option there does not prioritize a sibling. Signed-off-by: Andrea Righi <arighi@nvidia.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Breno Leitao <leitao@debian.org> Link: https://patch.msgid.link/20260929165538.726616-3-arighi@nvidia.com
This commit is contained in:
parent
c8fc4136fd
commit
648d44bda7
|
|
@ -6836,6 +6836,18 @@ Kernel parameters
|
|||
solution to mutex-based priority inversion.
|
||||
Format: <bool>
|
||||
|
||||
sched_smt_asym_packing= [KNL,SMP]
|
||||
Format: on
|
||||
Force asymmetric packing at the SMT scheduling domain.
|
||||
Idle CPU selection prefers siblings with a higher
|
||||
arch_asym_cpu_priority(). The default implementation
|
||||
prefers lower-numbered logical CPUs, but architecture
|
||||
overrides remain authoritative. Equal priorities do
|
||||
not establish a sibling preference. For example, x86
|
||||
with CONFIG_SCHED_MC_PRIO normally assigns the same
|
||||
core priority to both SMT siblings, so this option
|
||||
does not favor either sibling.
|
||||
|
||||
sched_verbose [KNL,EARLY] Enables verbose scheduler debug messages.
|
||||
|
||||
schedstats= [KNL,X86] Enable or disable scheduled statistics.
|
||||
|
|
|
|||
|
|
@ -32,6 +32,20 @@ static int __init sched_debug_setup(char *str)
|
|||
}
|
||||
early_param("sched_verbose", sched_debug_setup);
|
||||
|
||||
#ifdef CONFIG_SCHED_SMT
|
||||
static bool sched_smt_asym_packing __read_mostly;
|
||||
|
||||
static int __init setup_sched_smt_asym_packing(char *str)
|
||||
{
|
||||
if (strcmp(str, "on"))
|
||||
return 0;
|
||||
|
||||
sched_smt_asym_packing = true;
|
||||
return 1;
|
||||
}
|
||||
__setup("sched_smt_asym_packing=", setup_sched_smt_asym_packing);
|
||||
#endif
|
||||
|
||||
static inline bool sched_debug(void)
|
||||
{
|
||||
return sched_debug_verbose;
|
||||
|
|
@ -1950,6 +1964,10 @@ sd_init(struct sched_domain_topology_level *tl,
|
|||
if (WARN_ONCE(sd_flags & ~TOPOLOGY_SD_FLAGS,
|
||||
"wrong sd_flags in topology description\n"))
|
||||
sd_flags &= TOPOLOGY_SD_FLAGS;
|
||||
#ifdef CONFIG_SCHED_SMT
|
||||
if (sched_smt_asym_packing && (sd_flags & SD_SHARE_CPUCAPACITY))
|
||||
sd_flags |= SD_ASYM_PACKING;
|
||||
#endif
|
||||
sd_flags |= asym_cpu_capacity_classify(sd_span, cpu_map);
|
||||
|
||||
*sd = (struct sched_domain){
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user