[RFC 27/60] cosched: Add some small helper functions for later use

From: Jan H. SchÃnherr
Date: Fri Sep 07 2018 - 17:45:49 EST


Signed-off-by: Jan H. SchÃnherr <jschoenh@xxxxxxxxx>
---
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