From 5b814f5f90377ccf3004c674d4a0ae36b8803d6a Mon Sep 17 00:00:00 2001 From: Morten Rasmussen Date: Thu, 19 Oct 2017 13:50:06 +0100 Subject: [PATCH] ANDROID: arm: Enable dynamic sched_domain flag setting The patch lets the arch_topology driver take over setting of sched_domain flags that should be detected dynamically based on the actual system topology. cc: Russell King Signed-off-by: Morten Rasmussen Change-Id: I5bc17383c5666e8ff35d5109016dec98474997ce Signed-off-by: Chris Redpath --- arch/arm/include/asm/topology.h | 3 +++ arch/arm/kernel/topology.c | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/topology.h b/arch/arm/include/asm/topology.h index 5d88d2f22b2c..2a786f54d8b8 100644 --- a/arch/arm/include/asm/topology.h +++ b/arch/arm/include/asm/topology.h @@ -33,6 +33,9 @@ const struct cpumask *cpu_coregroup_mask(int cpu); /* Replace task scheduler's default cpu-invariant accounting */ #define arch_scale_cpu_capacity topology_get_cpu_scale +/* Enable topology flag updates */ +#define arch_update_cpu_topology topology_update_cpu_topology + #else static inline void init_cpu_topology(void) { } diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c index 24ac3cab411d..ce1a8026c8c4 100644 --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -278,23 +278,38 @@ void store_cpu_topology(unsigned int cpuid) update_cpu_capacity(cpuid); + topology_detect_flags(); + pr_info("CPU%u: thread %d, cpu %d, socket %d, mpidr %x\n", cpuid, cpu_topology[cpuid].thread_id, cpu_topology[cpuid].core_id, cpu_topology[cpuid].socket_id, mpidr); } +#ifdef CONFIG_SCHED_MC +static int core_flags(void) +{ + return cpu_core_flags() | topology_core_flags(); +} + static inline int cpu_corepower_flags(void) { - return SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; + return topology_core_flags() + | SD_SHARE_PKG_RESOURCES | SD_SHARE_POWERDOMAIN; +} +#endif + +static int cpu_flags(void) +{ + return topology_cpu_flags(); } 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) }, + { cpu_coregroup_mask, core_flags, SD_INIT_NAME(MC) }, #endif - { cpu_cpu_mask, SD_INIT_NAME(DIE) }, + { cpu_cpu_mask, cpu_flags, SD_INIT_NAME(DIE) }, { NULL, }, }; -- 2.20.1