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

Submitted by Kirill Tkhai on Feb. 20, 2018, 3:10 p.m.

Details

Message ID 151913940886.27906.8025456887320651920.stgit@localhost.localdomain
State New
Series "Fix wrong loadavg accounting inside CT"
Headers show

Commit Message

Kirill Tkhai Feb. 20, 2018, 3:10 p.m.
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@virtuozzo.com>
---
 kernel/sched/core.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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
 		}