[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1386936688-29113-2-git-send-email-dietmar.eggemann@arm.com>
Date: Fri, 13 Dec 2013 12:11:21 +0000
From: dietmar.eggemann@....com
To: peterz@...radead.org, mingo@...hat.com, vincent.guittot@...aro.org,
morten.rasmussen@....com, chris.redpath@....com
Cc: linux-kernel@...r.kernel.org, dietmar.eggemann@....com
Subject: [RFC PATCH 1/8] sched: arch interface for scheduler domain setup
From: Dietmar Eggemann <dietmar.eggemann@....com>
This patch defines an arch interface to provide the number of scheduler
domain levels, the pointer to the function returning the cpu mask and the
topology flags for each scheduler domain level.
The cpu mask getter functions for the smt and cpu level as well as the
function pointer sched_domain_mask_f have been moved from the scheduler
code into the topology header file.
The arch has to provide the arch_sched_domain_info array with an entry for
each scheduler domain level specifying the pointer to the cpu mask getter
function and the topology flags.
This patch covers all scheduler domain levels except NUMA levels.
Signed-off-by: Dietmar Eggemann <dietmar.eggemann@....com>
---
include/linux/topology.h | 41 +++++++++++++++++++++++++++++++++++++++++
kernel/sched/core.c | 13 -------------
2 files changed, 41 insertions(+), 13 deletions(-)
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 12ae6ce997d6..d147f63c2b1f 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -295,4 +295,45 @@ static inline int cpu_to_mem(int cpu)
#define topology_core_cpumask(cpu) cpumask_of(cpu)
#endif
+#ifdef CONFIG_SCHED_SMT
+static inline const struct cpumask *cpu_smt_mask(int cpu)
+{
+ return topology_thread_cpumask(cpu);
+}
+#endif
+
+static inline const struct cpumask *cpu_cpu_mask(int cpu)
+{
+ return cpumask_of_node(cpu_to_node(cpu));
+}
+
+typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
+
+typedef struct {
+ sched_domain_mask_f mask;
+ unsigned int flags;
+} arch_sched_domain_info_t;
+
+extern arch_sched_domain_info_t arch_sched_domain_info[];
+
+static inline unsigned int arch_sd_levels(void)
+{
+ unsigned int i;
+
+ for (i = 0; arch_sched_domain_info[i].mask; i++)
+ ;
+
+ return i;
+}
+
+static inline sched_domain_mask_f arch_sd_mask(unsigned int i)
+{
+ return arch_sched_domain_info[i].mask;
+}
+
+static inline unsigned int arch_sd_flags(unsigned int i)
+{
+ return arch_sched_domain_info[i].flags;
+}
+
#endif /* _LINUX_TOPOLOGY_H */
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index e85cda20ab2b..fe21f7efb2ee 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4987,11 +4987,6 @@ static int __init isolated_cpu_setup(char *str)
__setup("isolcpus=", isolated_cpu_setup);
-static const struct cpumask *cpu_cpu_mask(int cpu)
-{
- return cpumask_of_node(cpu_to_node(cpu));
-}
-
struct sd_data {
struct sched_domain **__percpu sd;
struct sched_group **__percpu sg;
@@ -5013,7 +5008,6 @@ enum s_alloc {
struct sched_domain_topology_level;
typedef struct sched_domain *(*sched_domain_init_f)(struct sched_domain_topology_level *tl, int cpu);
-typedef const struct cpumask *(*sched_domain_mask_f)(int cpu);
#define SDTL_OVERLAP 0x01
@@ -5367,13 +5361,6 @@ static void claim_allocations(int cpu, struct sched_domain *sd)
*per_cpu_ptr(sdd->sgp, cpu) = NULL;
}
-#ifdef CONFIG_SCHED_SMT
-static const struct cpumask *cpu_smt_mask(int cpu)
-{
- return topology_thread_cpumask(cpu);
-}
-#endif
-
/*
* Topology list, bottom-up.
*/
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists