[Devel] [PATCH rh8 6/6] vzstat: Add kstat_glob.nr_unint_avg real accounting
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Oct 22 15:54:52 MSK 2020
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>
---
kernel/sched/loadavg.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
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 */
--
2.28.0
More information about the Devel
mailing list