[Devel] [PATCH RHEL COMMIT] vzstat: Add kstat_glob.nr_unint_avg real accounting

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 1 19:38:46 MSK 2021


The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after ark-5.14
------>
commit 53a91c3c18f1f431d4f783ae2d5d97fd20af1865
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Fri Oct 1 19:38:45 2021 +0300

    vzstat: Add kstat_glob.nr_unint_avg real accounting
    
    This should be a part of commit
    127bd48f3385 ("vzstat: Add vzstat module and kstat interfaces")
    
    but depends on task_group::avenrun accounting and thus goes separately.
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
    
    (cherry-picked from vz8 commit 8325732346ba ("vzstat: Add
    kstat_glob.nr_unint_avg real accounting"))
    
    Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
---
 kernel/sched/loadavg.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index c26db6cef1b5..0174c40c7468 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -7,6 +7,7 @@
  * great pains to make it work on big machines and tickless kernels.
  */
 #include "sched.h"
+#include <linux/vzstat.h>
 
 /*
  * Global load-average calculations
@@ -113,7 +114,7 @@ extern spinlock_t load_ve_lock;
 
 void calc_load_ve(void)
 {
-	unsigned long nr_active;
+	unsigned long nr_unint, nr_active;
 	struct task_group *tg;
 	int i;
 
@@ -145,6 +146,14 @@ void calc_load_ve(void)
 		tg->avenrun[1] = calc_load(tg->avenrun[1], EXP_5, nr_active);
 		tg->avenrun[2] = calc_load(tg->avenrun[2], EXP_15, nr_active);
 	}
+
+	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);
+	write_seqcount_end(&kstat_glob.nr_unint_avg_seq);
 	spin_unlock(&load_ve_lock);
 }
 #endif /* CONFIG_VE */


More information about the Devel mailing list