If there are shared processor lpars, underlying Hypervisor can have more virtual cores to handle that actual physical cores.
Starting with Power 9, a core has 2 nearly independent thread groups. On a shared processors lpars, it helps to pack threads to lesser number of cores so that the overall system performance and utilization improves. PowerVM schedules at a core level. Hence packing to fewer cores helps. For example: Lets says there are two 8-core Shared lpars that are actually sharing a 8 Core shared physical pool, each running 8 threads each. Then Consolidating 8 threads to 4 cores on each lpar would help them to perform better. To achieve this, enable SD_ASYM_PACKING flag at CACHE, MC and DIE level. Signed-off-by: Srikar Dronamraju <sri...@linux.vnet.ibm.com> --- arch/powerpc/kernel/smp.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index c7d1484ed230..51403640440c 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -1005,7 +1005,12 @@ static int powerpc_smt_flags(void) */ static int powerpc_shared_cache_flags(void) { - return SD_SHARE_PKG_RESOURCES; + return SD_SHARE_PKG_RESOURCES | asym_pack_flag; +} + +static int powerpc_shared_proc_flags(void) +{ + return asym_pack_flag; } /* @@ -1044,8 +1049,8 @@ static struct sched_domain_topology_level powerpc_topology[] = { { cpu_smt_mask, powerpc_smt_flags, SD_INIT_NAME(SMT) }, #endif { shared_cache_mask, powerpc_shared_cache_flags, SD_INIT_NAME(CACHE) }, - { cpu_mc_mask, SD_INIT_NAME(MC) }, - { cpu_cpu_mask, SD_INIT_NAME(DIE) }, + { cpu_mc_mask, powerpc_shared_proc_flags, SD_INIT_NAME(MC) }, + { cpu_cpu_mask, powerpc_shared_proc_flags, SD_INIT_NAME(DIE) }, { NULL, }, }; @@ -1671,7 +1676,9 @@ static void __init fixup_topology(void) { int i; - if (cpu_has_feature(CPU_FTR_ASYM_SMT)) { + if (is_shared_processor()) { + asym_pack_flag = SD_ASYM_PACKING; + } else if (cpu_has_feature(CPU_FTR_ASYM_SMT)) { printk_once(KERN_INFO "Enabling Asymmetric SMT scheduling\n"); asym_pack_flag = SD_ASYM_PACKING; } -- 2.41.0