While rebuilding a sched-domain, arch_update_cpu_topology() is a way for
the architecture to tell the scheduler that there are asymmetric CPU
capacities that need to be taken care.

If arch_update_cpu_topology() returns non-zero, then scheduler shall
rebuild the topology post scanning the CPU capacities.

On Powerpc, If there are soft-offlined CPUs, then inform the scheduler
to scan for possible asymmetric CPU capacities.

Signed-off-by: Srikar Dronamraju <[email protected]>
---
 arch/powerpc/include/asm/smp.h | 3 +++
 arch/powerpc/kernel/smp.c      | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index fe6315057474..92842eda1a03 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -269,6 +269,9 @@ extern char __secondary_hold;
 extern unsigned int booting_thread_hwid;
 
 extern void __early_start(void);
+#ifdef CONFIG_PPC_SPLPAR
+int arch_update_cpu_topology(void);
+#endif /* CONFIG_PPC_SPLPAR */
 #endif /* __ASSEMBLER__ */
 
 #endif /* __KERNEL__ */
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index c269b38dcba5..478847d6ab7c 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -1827,4 +1827,12 @@ unsigned long arch_scale_cpu_capacity(int cpu)
        }
        return SCHED_CAPACITY_SCALE;
 }
+
+int arch_update_cpu_topology(void)
+{
+       if (is_shared_processor() && !is_kvm_guest())
+               return (num_online_cpus() != cpumask_weight(cpu_active_mask));
+
+       return 0;
+}
 #endif /* CONFIG_PPC_SPLPAR */
-- 
2.43.7


Reply via email to