[Devel] [PATCH vz9 17/23] vzstat: Add kstat_glob.nr_unint_avg real accounting
Nikita Yushchenko
nikita.yushchenko at virtuozzo.com
Fri Oct 1 18:53:25 MSK 2021
From: Konstantin Khorenko <khorenko at virtuozzo.com>
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 */
--
2.30.2
More information about the Devel
mailing list