[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180907214047.26914-33-jschoenh@amazon.de>
Date: Fri, 7 Sep 2018 23:40:19 +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 32/60] cosched: Specialize parent_cfs_rq() for hierarchical runqueues
Make parent_cfs_rq() coscheduling-aware.
Signed-off-by: Jan H. Schönherr <jschoenh@...zon.de>
---
kernel/sched/fair.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 8504790944bf..8cba7b8fb6bd 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -284,12 +284,25 @@ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp)
return grp->my_q;
}
+#ifdef CONFIG_COSCHEDULING
+static inline struct cfs_rq *parent_cfs_rq(struct cfs_rq *cfs_rq)
+{
+ /*
+ * Only return TG parent (if valid), don't switch levels.
+ * Callers stay or expect to stay within the same level.
+ */
+ if (!cfs_rq->sdrq.tg_parent || !cfs_rq->sdrq.is_root)
+ return NULL;
+ return cfs_rq->sdrq.tg_parent->cfs_rq;
+}
+#else /* !CONFIG_COSCHEDULING */
static inline struct cfs_rq *parent_cfs_rq(struct cfs_rq *cfs_rq)
{
if (!cfs_rq->tg->parent)
return NULL;
return cfs_rq->tg->parent->cfs_rq[cpu_of(rq_of(cfs_rq))];
}
+#endif /* !CONFIG_COSCHEDULING */
static inline void list_add_leaf_cfs_rq(struct cfs_rq *cfs_rq)
{
--
2.9.3.1.gcba166c.dirty
Powered by blists - more mailing lists