[Devel] [PATCH RHEL10 COMMIT] vzstat: store calc_load() result back into kstat_glob.nr_unint_avg[]

Konstantin Khorenko khorenko at virtuozzo.com
Mon Jun 15 13:53:44 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.el10
------>
commit bc61c5debd58120e2b9feffb93f0fa32b5b2ae34
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Wed Jun 3 23:53:44 2026 +0200

    vzstat: store calc_load() result back into kstat_glob.nr_unint_avg[]
    
    calc_load() is a pure function that returns the updated load average; it
    does not modify its first argument (passed by value). calc_load_ve()
    computed the three nr_unint_avg[] values but discarded the return value:
    
            calc_load(kstat_glob.nr_unint_avg[0], EXP_1, nr_unint);
            calc_load(kstat_glob.nr_unint_avg[1], EXP_5, nr_unint);
            calc_load(kstat_glob.nr_unint_avg[2], EXP_15, nr_unint);
    
    so kstat_glob.nr_unint_avg[] stayed 0 forever and the "Processes avg:
    unint" line of the vzstat output always reported 0. The neighbouring
    per-tg avenrun update in the same file does it correctly
    (tg->avenrun[i] = calc_load(tg->avenrun[i], ...)).
    
    Assign the result back, matching the avenrun pattern.
    
    Fixes: 1ec8acd9eeed ("vzstat: Add kstat_glob.nr_unint_avg real accounting")
    https://virtuozzo.atlassian.net/browse/VSTOR-132310
    Feature: ve: extra statistics (mm, latency)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 kernel/sched/loadavg.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index a69358e4951d..bc0b6bcdae2d 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -161,9 +161,9 @@ void calc_load_ve(void)
 	nr_unint = nr_uninterruptible() * FIXED_1;
 
 	write_seqcount_begin(&kstat_glob.nr_unint_avg_seq);
-	calc_load(kstat_glob.nr_unint_avg[0], EXP_1, nr_unint);
-	calc_load(kstat_glob.nr_unint_avg[1], EXP_5, nr_unint);
-	calc_load(kstat_glob.nr_unint_avg[2], EXP_15, nr_unint);
+	kstat_glob.nr_unint_avg[0] = calc_load(kstat_glob.nr_unint_avg[0], EXP_1, nr_unint);
+	kstat_glob.nr_unint_avg[1] = calc_load(kstat_glob.nr_unint_avg[1], EXP_5, nr_unint);
+	kstat_glob.nr_unint_avg[2] = calc_load(kstat_glob.nr_unint_avg[2], EXP_15, nr_unint);
 	write_seqcount_end(&kstat_glob.nr_unint_avg_seq);
 }
 #endif /* CONFIG_VE */


More information about the Devel mailing list