[Devel] [PATCH RHEL8 COMMIT] vzstat: Add kstat_glob.nr_unint_avg real accounting
Konstantin Khorenko
khorenko at virtuozzo.com
Mon Oct 19 14:20:43 MSK 2020
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 66773dbd21073822bcc5dd1b4f86c8e49d73b3e4
Author: Konstantin Khorenko <khorenko at 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 at virtuozzo.com>
---
kernel/sched/loadavg.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/loadavg.c b/kernel/sched/loadavg.c
index dafa428dc1ba..1793dee04183 100644
--- a/kernel/sched/loadavg.c
+++ b/kernel/sched/loadavg.c
@@ -102,7 +102,7 @@ long calc_load_fold_active(struct rq *this_rq, long adjust)
#ifdef CONFIG_VE
static void calc_load_ve(void)
{
- unsigned long nr_active;
+ unsigned long nr_unint, nr_active;
struct task_group *tg;
int i;
@@ -122,6 +122,18 @@ static void calc_load_ve(void)
tg->avenrun[2] = calc_load(tg->avenrun[2], EXP_15, nr_active);
}
rcu_read_unlock();
+
+ nr_unint = nr_uninterruptible() * FIXED_1;
+ /*
+ * This is called from do_timer() only, which can't be excuted
+ * in parallel on two or more cpus. So, we have to protect
+ * the below modifications from readers only.
+ */
+ 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);
}
#else
#define calc_load_ve() do { } while (0)
More information about the Devel
mailing list