[Devel] [PATCH 5/5] sched/ve: Use cfs_rq::h_nr_running to count loadavg

Kirill Tkhai ktkhai at virtuozzo.com
Tue Feb 20 18:10:09 MSK 2018


cfs_rq::nr_running contains number of child entities
of one level below: tasks and cfs_rq, but it does not
contain tasks from deeper levels.

Use cfs_rq::h_nr_running instead as it contains number
of tasks among all child hierarchy.

https://jira.sw.ru/browse/PSBM-81572

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 kernel/sched/core.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f93334fd0229..f14bbf5c8ed6 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2894,7 +2894,13 @@ static void calc_load_ve(void)
 		nr_active = 0;
 		for_each_possible_cpu(i) {
 #ifdef CONFIG_FAIR_GROUP_SCHED
-			nr_active += tg->cfs_rq[i]->nr_running;
+			nr_active += tg->cfs_rq[i]->h_nr_running;
+			/*
+                         * We do not export nr_unint to parent task groups
+                         * like we do for h_nr_running, as it gives additional
+                         * overhead for activate/deactivate operations. So, we
+			 * don't account child cgroup unint tasks here.
+                         */
 			nr_active += tg->cfs_rq[i]->nr_unint;
 #endif
 		}



More information about the Devel mailing list