[Devel] [PATCH rh7 1/4] sched: account task_group->nr_cpus_active for all cgroups

Vladimir Davydov vdavydov at virtuozzo.com
Wed Jul 13 09:37:15 PDT 2016


Currently nr_cpus_active is only accounted for top-level cgroups,
because container cgroups, which are the only users of this counter,
could only be created under the root cgroup.

Now things have changed, and containers can reside either under the root
or under machine.slice or in any other cgroup depending on the host's
config. So we can't preserve this little optimization anymore. Remove
it.

Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index fd25e1e8ae5b..70a5861d4166 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3039,7 +3039,7 @@ static void check_enqueue_throttle(struct cfs_rq *cfs_rq);
 static void
 enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
 {
-	if (is_top_cfs_rq(cfs_rq) && !cfs_rq->load.weight)
+	if (!cfs_rq->load.weight)
 		inc_nr_active_cfs_rqs(cfs_rq);
 
 	/*
@@ -3163,7 +3163,7 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int flags)
 	update_min_vruntime(cfs_rq);
 	update_cfs_shares(cfs_rq);
 
-	if (is_top_cfs_rq(cfs_rq) && !cfs_rq->load.weight)
+	if (!cfs_rq->load.weight)
 		dec_nr_active_cfs_rqs(cfs_rq, flags & DEQUEUE_TASK_SLEEP);
 }
 
-- 
2.1.4



More information about the Devel mailing list