mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: dietmar.eggemann@arm.com
To: peterz@infradead.org, mingo@redhat.com,
	vincent.guittot@linaro.org, morten.rasmussen@arm.com,
	chris.redpath@arm.com
Cc: linux-kernel@vger.kernel.org, dietmar.eggemann@arm.com
Subject: [RFC PATCH 1/8] sched: arch interface for scheduler domain setup
Date: Fri, 13 Dec 2013 12:11:21 +0000	[thread overview]
Message-ID: <1386936688-29113-2-git-send-email-dietmar.eggemann@arm.com> (raw)
In-Reply-To: <1386936688-29113-1-git-send-email-dietmar.eggemann@arm.com>

From: Dietmar Eggemann <dietmar.eggemann@arm.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@arm.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



  reply	other threads:[~2013-12-13 12:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-13 12:11 [RFC PATCH 0/8] change scheduler domain hierarchy set-up dietmar.eggemann
2013-12-13 12:11 ` dietmar.eggemann [this message]
2013-12-13 12:11 ` [RFC PATCH 2/8] arm: implement arch interface for scheduler domain setup dietmar.eggemann
2013-12-13 12:11 ` [RFC PATCH 3/8] x86: " dietmar.eggemann
2013-12-13 12:11 ` [RFC PATCH 4/8] sched: allocate the entire topology array dynamically dietmar.eggemann
2013-12-13 12:11 ` [RFC PATCH 5/8] sched: introduce common topology level init function dietmar.eggemann
2013-12-20 14:04   ` Peter Zijlstra
2014-01-06 18:41     ` Dietmar Eggemann
2013-12-13 12:11 ` [RFC PATCH 6/8] sched: replace for_each_sd_topology with explicit for loop dietmar.eggemann
2013-12-13 12:11 ` [RFC PATCH 7/8] sched: replace topology level init func ptr with sd_init dietmar.eggemann
2013-12-13 12:11 ` [RFC PATCH 8/8] sched: remove scheduler domain naming dietmar.eggemann
2013-12-20 14:08   ` Peter Zijlstra
2014-01-06 18:41     ` Dietmar Eggemann
2014-01-07 10:22       ` Peter Zijlstra
2014-01-07 14:33         ` Dietmar Eggemann
2013-12-20 14:00 ` [RFC PATCH 0/8] change scheduler domain hierarchy set-up Peter Zijlstra
2014-01-06 18:40   ` Dietmar Eggemann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1386936688-29113-2-git-send-email-dietmar.eggemann@arm.com \
    --to=dietmar.eggemann@arm.com \
    --cc=chris.redpath@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=morten.rasmussen@arm.com \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®