lkml.org 
[lkml]   [2018]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 09/60] sched: Do not require a CFS in init_tg_cfs_entry()
Date
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@amazon.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
\
 
 \ /
  Last update: 2018-09-07 23:53    [W:0.692 / U:1.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site