Add a cpu_power() call to machdep_calls, which will allow platforms to override the scheduler's default cpu power calculation. If the platform does not provide a cpu_power() method, the scheduler's default value is used.
Copy the default SD_SIBLING_INIT to powerpc's topology.h and add the SD_ASYM_CPU_POWER flag, which will cause ppc_md.cpu_power() to be invoked (via arch_cpu_power()) during sched domain initialization. Signed-off-by: Nathan Lynch <[EMAIL PROTECTED]> --- arch/powerpc/kernel/setup-common.c | 7 +++++++ include/asm-powerpc/machdep.h | 2 ++ include/asm-powerpc/topology.h | 31 +++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 0 deletions(-) diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index db540ea..609d09e 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c @@ -671,3 +671,10 @@ static int powerpc_debugfs_init(void) } arch_initcall(powerpc_debugfs_init); #endif + +unsigned int arch_cpu_power(int cpu, unsigned int default_power) +{ + if (ppc_md.cpu_power) + return ppc_md.cpu_power(cpu, default_power); + return default_power; +} diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h index 54ed64d..de6ff6b 100644 --- a/include/asm-powerpc/machdep.h +++ b/include/asm-powerpc/machdep.h @@ -260,6 +260,8 @@ struct machdep_calls { void (*suspend_disable_irqs)(void); void (*suspend_enable_irqs)(void); #endif + /* Override scheduler's cpu power calculation */ + unsigned int (*cpu_power)(int cpu, unsigned int default_power); }; extern void power4_idle(void); diff --git a/include/asm-powerpc/topology.h b/include/asm-powerpc/topology.h index 100c6fb..4335c15 100644 --- a/include/asm-powerpc/topology.h +++ b/include/asm-powerpc/topology.h @@ -72,6 +72,37 @@ static inline int pcibus_to_node(struct pci_bus *bus) .nr_balance_failed = 0, \ } +#define SD_SIBLING_INIT (struct sched_domain) { \ + .span = CPU_MASK_NONE, \ + .parent = NULL, \ + .child = NULL, \ + .groups = NULL, \ + .min_interval = 1, \ + .max_interval = 2, \ + .busy_factor = 64, \ + .imbalance_pct = 110, \ + .cache_nice_tries = 0, \ + .busy_idx = 0, \ + .idle_idx = 0, \ + .newidle_idx = 0, \ + .wake_idx = 0, \ + .forkexec_idx = 0, \ + .flags = SD_LOAD_BALANCE \ + | SD_BALANCE_NEWIDLE \ + | SD_BALANCE_FORK \ + | SD_BALANCE_EXEC \ + | SD_WAKE_AFFINE \ + | SD_WAKE_IDLE \ + | SD_SHARE_CPUPOWER \ + | SD_ASYM_CPU_POWER, \ + .last_balance = jiffies, \ + .balance_interval = 1, \ + .nr_balance_failed = 0, \ +} + +#define arch_cpu_power(cpu, power) arch_cpu_power(cpu, power) +extern unsigned int arch_cpu_power(int cpu, unsigned int default_power); + extern void __init dump_numa_cpu_topology(void); extern int sysfs_add_device_to_node(struct sys_device *dev, int nid); -- 1.5.5 _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev