[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180907214047.26914-28-jschoenh@amazon.de>
Date: Fri, 7 Sep 2018 23:40:14 +0200
From: Jan H. Schönherr <jschoenh@...zon.de>
To: Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: Jan H. Schönherr <jschoenh@...zon.de>,
linux-kernel@...r.kernel.org
Subject: [RFC 27/60] cosched: Add some small helper functions for later use
Signed-off-by: Jan H. Schönherr <jschoenh@...zon.de>
---
kernel/sched/sched.h | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index d65c98c34c13..456b266b8a2c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1130,6 +1130,40 @@ static inline struct cfs_rq *taskgroup_next_cfsrq(struct task_group *tg,
#endif /* CONFIG_FAIR_GROUP_SCHED */
#ifdef CONFIG_COSCHEDULING
+static inline int node_of(struct rq *rq)
+{
+ return rq->sdrq_data.numa_node;
+}
+
+static inline bool is_cpu_rq(struct rq *rq)
+{
+ return !rq->sdrq_data.level;
+}
+
+static inline struct rq *parent_rq(struct rq *rq)
+{
+ if (!rq->sdrq_data.parent)
+ return NULL;
+ return container_of(rq->sdrq_data.parent, struct rq, sdrq_data);
+}
+#else /* !CONFIG_COSCHEDULING */
+static inline int node_of(struct rq *rq)
+{
+ return cpu_to_node(cpu_of(rq));
+}
+
+static inline bool is_cpu_rq(struct rq *rq)
+{
+ return true;
+}
+
+static inline struct rq *parent_rq(struct rq *rq)
+{
+ return NULL;
+}
+#endif /* !CONFIG_COSCHEDULING */
+
+#ifdef CONFIG_COSCHEDULING
void cosched_init_bottom(void);
void cosched_init_topology(void);
void cosched_init_hierarchy(void);
--
2.9.3.1.gcba166c.dirty
Powered by blists - more mailing lists