[RHEL8,COMMIT] vzstat: Add kstat_glob.nr_unint_avg real accounting

Submitted by Konstantin Khorenko on Oct. 28, 2020, 4:21 p.m.

Details

Message ID 202010281621.09SGLvR81544770@finist-co8.sw.ru
State New
Series "ve/sched/loadavg: loadavg virtualization"
Headers show

Commit Message

Konstantin Khorenko Oct. 28, 2020, 4:21 p.m.
The commit is pushed to "branch-rh8-4.18.0-193.6.3.vz8.4.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-193.6.3.vz8.4.14
------>
commit fe6585fb13b2318202f0dba0cab87ca410b2c593
Author: Konstantin Khorenko <khorenko@virtuozzo.com>
Date:   Mon Oct 19 13:57:36 2020 +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@virtuozzo.com>
---
 kernel/sched/loadavg.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index c62f34033112..c76b1c842ad8 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -105,7 +105,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;
 
@@ -137,6 +137,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 */