OSDN Git Service

ANDROID: arm64: Enable dynamic sched_domain flag setting
authorMorten Rasmussen <morten.rasmussen@arm.com>
Thu, 19 Oct 2017 12:51:54 +0000 (13:51 +0100)
committerAmit Pundir <amit.pundir@linaro.org>
Tue, 14 Aug 2018 12:17:11 +0000 (17:47 +0530)
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 <catalin.marinas@arm.com>
cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Morten Rasmussen <morten.rasmussen@arm.com>
Change-Id: I56b496517fe5d3a67f8650a661ea0a046ab81b59

arch/arm64/include/asm/topology.h
arch/arm64/kernel/topology.c

index df48212..61ba09d 100644 (file)
@@ -43,6 +43,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 <asm-generic/topology.h>
 
 #endif /* _ASM_ARM_TOPOLOGY_H */
index f845a86..0f7c9a8 100644 (file)
@@ -291,8 +291,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;
@@ -380,4 +411,6 @@ void __init init_cpu_topology(void)
                reset_cpu_topology();
        else if (of_have_populated_dt() && parse_dt_topology())
                reset_cpu_topology();
+       else
+               set_sched_topology(arm64_topology);
 }