From: Morten Rasmussen Date: Thu, 19 Oct 2017 12:51:54 +0000 (+0100) Subject: ANDROID: arm64: Enable dynamic sched_domain flag setting X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f505b7765e31947f5cbdcf803f2b29a28f9ba362;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git ANDROID: arm64: 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: Catalin Marinas cc: Will Deacon Signed-off-by: Morten Rasmussen Change-Id: I7886c0a53899987e77ef6937e1c667bf32a58bfd Signed-off-by: Chris Redpath --- diff --git a/arch/arm64/include/asm/topology.h b/arch/arm64/include/asm/topology.h index c4f2d50491eb..13a00ece862b 100644 --- a/arch/arm64/include/asm/topology.h +++ b/arch/arm64/include/asm/topology.h @@ -41,6 +41,9 @@ int pcibus_to_node(struct pci_bus *bus); /* 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 + #include #endif /* _ASM_ARM_TOPOLOGY_H */ diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 8d48b233e6ce..de70e2194d8d 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -280,8 +280,39 @@ void store_cpu_topology(unsigned int cpuid) topology_populated: update_siblings_masks(cpuid); + topology_detect_flags(); } +#ifdef CONFIG_SCHED_SMT +static int smt_flags(void) +{ + return cpu_smt_flags() | topology_smt_flags(); +} +#endif + +#ifdef CONFIG_SCHED_MC +static int core_flags(void) +{ + return cpu_core_flags() | topology_core_flags(); +} +#endif + +static int cpu_flags(void) +{ + return topology_cpu_flags(); +} + +static struct sched_domain_topology_level arm64_topology[] = { +#ifdef CONFIG_SCHED_SMT + { cpu_smt_mask, smt_flags, SD_INIT_NAME(SMT) }, +#endif +#ifdef CONFIG_SCHED_MC + { cpu_coregroup_mask, core_flags, SD_INIT_NAME(MC) }, +#endif + { cpu_cpu_mask, cpu_flags, SD_INIT_NAME(DIE) }, + { NULL, } +}; + static void __init reset_cpu_topology(void) { unsigned int cpu; @@ -310,4 +341,6 @@ void __init init_cpu_topology(void) */ if (of_have_populated_dt() && parse_dt_topology()) reset_cpu_topology(); + else + set_sched_topology(arm64_topology); }