[PATCH 14/16] arm: Set SD_ASYM_CPUCAPACITY for big.LITTLE platforms

From: Morten Rasmussen
Date: Mon May 23 2016 - 06:59:39 EST


Set the SD_ASYM_CPUCAPACITY flag for DIE level sched_domain on
big.LITTLE systems.

cc: Russell King <linux@xxxxxxxxxxxxxxxx>

Signed-off-by: Morten Rasmussen <morten.rasmussen@xxxxxxx>
---
arch/arm/kernel/topology.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index ec279d1..1b81b31 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -78,6 +78,7 @@ static unsigned long *__cpu_capacity;
#define cpu_capacity(cpu) __cpu_capacity[cpu]

static unsigned long middle_capacity = 1;
+static unsigned int big_little;

/*
* Iterate all CPUs' descriptor in DT and compute the efficiency
@@ -151,6 +152,8 @@ static void __init parse_dt_topology(void)
middle_capacity = ((max_capacity / 3)
>> (SCHED_CAPACITY_SHIFT-1)) + 1;

+ if (max_capacity && max_capacity != min_capacity)
+ big_little = 1;
}

/*
@@ -280,12 +283,17 @@ static inline int cpu_corepower_flags(void)
return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN;
}

+static inline int arm_cpu_cpu_flags(void)
+{
+ return big_little ? SD_ASYM_CPUCAPACITY : 0;
+}
+
static struct sched_domain_topology_level arm_topology[] = {
#ifdef CONFIG_SCHED_MC
{ cpu_corepower_mask, cpu_corepower_flags, SD_INIT_NAME(GMC) },
{ cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) },
#endif
- { cpu_cpu_mask, SD_INIT_NAME(DIE) },
+ { cpu_cpu_mask, arm_cpu_cpu_flags, SD_INIT_NAME(DIE) },
{ NULL, },
};

--
1.9.1