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)
committerChris Redpath <chris.redpath@arm.com>
Thu, 14 Dec 2017 21:41:07 +0000 (21:41 +0000)
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: I7886c0a53899987e77ef6937e1c667bf32a58bfd
Signed-off-by: Chris Redpath <chris.redpath@arm.com>
arch/arm64/include/asm/topology.h
arch/arm64/kernel/topology.c

index c4f2d50491eb113fad8894b6df20cca4083e0858..13a00ece862bb3f19422612d0ea2dfb98dd68085 100644 (file)
@@ -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 <asm-generic/topology.h>
 
 #endif /* _ASM_ARM_TOPOLOGY_H */
index 8d48b233e6ce5d09cd84db6a21a52f4d0dd68e97..de70e2194d8d9efa749ad8c88a93a70712650129 100644 (file)
@@ -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);
 }