[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180907214047.26914-10-jschoenh@amazon.de>
Date: Fri, 7 Sep 2018 23:39:56 +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 09/60] sched: Do not require a CFS in init_tg_cfs_entry()
Just like init_tg_cfs_entry() does something useful without a scheduling
entity, let it do something useful without a CFS runqueue.
This prepares for the addition of new types of SEs.
Signed-off-by: Jan H. Schönherr <jschoenh@...zon.de>
---
kernel/sched/fair.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 2b3fd7cd9fde..bccd7a66858e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -9903,21 +9903,23 @@ void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq,
struct sched_entity *se, struct rq *rq,
struct cfs_rq *parent)
{
- cfs_rq->tg = tg;
- cfs_rq->rq = rq;
- cfs_rq->my_se = se;
- init_cfs_rq_runtime(cfs_rq);
-
- /* se could be NULL for root_task_group */
- if (!se)
- return;
+ /* cfs_rq may be NULL for certain types of SE */
+ if (cfs_rq) {
+ cfs_rq->tg = tg;
+ cfs_rq->rq = rq;
+ cfs_rq->my_se = se;
+ init_cfs_rq_runtime(cfs_rq);
+ }
- set_entity_cfs(se, parent);
- se->my_q = cfs_rq;
+ /* se is NULL for root_task_group */
+ if (se) {
+ set_entity_cfs(se, parent);
+ se->my_q = cfs_rq;
- /* guarantee group entities always have weight */
- update_load_set(&se->load, NICE_0_LOAD);
- init_entity_runnable_average(se);
+ /* guarantee group entities always have weight */
+ update_load_set(&se->load, NICE_0_LOAD);
+ init_entity_runnable_average(se);
+ }
}
static DEFINE_MUTEX(shares_mutex);
--
2.9.3.1.gcba166c.dirty
Powered by blists - more mailing lists