[Devel] [PATCH RHEL8 COMMIT] sched/ve: Do not show loadavg in child VE cpu cgroups

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 24 18:31:57 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.32
------>
commit e3d712367a31b5fc48eabb3b02afedec7f6f0dbd
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon May 24 18:31:57 2021 +0300

    sched/ve: Do not show loadavg in child VE cpu cgroups
    
    CT's loadavg is analogy of node's loadavg, and we shouldn't
    introduce it for child cpu cgroups.
    
    We can calculate/generate file content for root_task_group only,
    others will return empty file content.
    
    https://jira.sw.ru/browse/PSBM-81572
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
    
    (cherry picked from vz7 commit e0199c52bdf4 ("sched/ve: Do not show loadavg in
    child VE cpu cgroups"))
    
    See also
    f49dfc054 ("vecalls: Introduce VZCTL_GET_CPU_STAT ioctl")
    b72dd2c52 ("sched: Export per task_group statistics_work")
    
    VZ 8 rebase part https://jira.sw.ru/browse/PSBM-127797
    
    Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalitsyn at virtuozzo.com>
---
 kernel/sched/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 3878a91a54b5..c2880cf6cf60 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7366,6 +7366,9 @@ int cpu_cgroup_proc_loadavg(struct cgroup_subsys_state *css,
 	int nr_running = 0;
 	int i;
 
+	if (!test_bit(CGRP_VE_ROOT, &cgrp->flags))
+		return 0;
+
 	avnrun[0] = tg->avenrun[0] + FIXED_1/200;
 	avnrun[1] = tg->avenrun[1] + FIXED_1/200;
 	avnrun[2] = tg->avenrun[2] + FIXED_1/200;


More information about the Devel mailing list