[Devel] [PATCH RHEL8 COMMIT] /proc/vz/latency: Show max latency in 2 min instead of 5sec.
Konstantin Khorenko
khorenko at virtuozzo.com
Mon May 24 20:34:28 MSK 2021
The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.32
------>
commit 316ab69e2054625b2da0ab0f834813799af65764
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date: Mon May 24 20:34:28 2021 +0300
/proc/vz/latency: Show max latency in 2 min instead of 5sec.
Historically the "Lat" column in /proc/vz/latency showed max latency
in 5 seconds. Chnage it to max latency in the last 2 minutes, the same
as in the /proc/<pid>/vz_latency
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
(cherry-picked from vz7 commit 0c5707cfcc84 ("/proc/vz/latency: Show max latency
in 2 min instead of 5sec."))
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
kernel/ve/vzstat.c | 2 +-
kernel/ve/vzstat_core.c | 17 +++++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/kernel/ve/vzstat.c b/kernel/ve/vzstat.c
index 0180ccf685ac..0fb0cfbb0407 100644
--- a/kernel/ve/vzstat.c
+++ b/kernel/ve/vzstat.c
@@ -168,7 +168,7 @@ static void lastlat_seq_show(struct seq_file *m,
struct kstat_lat_snap_struct *snap)
{
seq_printf(m, "%-11s %20Lu %20Lu %20lu\n", name,
- snap->maxlat[0], snap->totlat, snap->count);
+ get_max_lat(snap), snap->totlat, snap->count);
}
static void avglat_seq_show(struct seq_file *m,
diff --git a/kernel/ve/vzstat_core.c b/kernel/ve/vzstat_core.c
index 3ec69bf368d9..7f8d34688e61 100644
--- a/kernel/ve/vzstat_core.c
+++ b/kernel/ve/vzstat_core.c
@@ -70,8 +70,9 @@ void KSTAT_LAT_PCPU_UPDATE(struct kstat_lat_pcpu_struct *p)
unsigned i, cpu;
seqcount_t *seq;
u64 m;
+ u64 maxlat = 0, totlat = 0;
+ unsigned long count = 0;
- memset(&p->last, 0, sizeof(p->last));
for_each_online_cpu(cpu) {
cur = per_cpu_ptr(p->cur, cpu);
seq = per_cpu_ptr(&kstat_pcpu_seq, cpu);
@@ -86,17 +87,21 @@ void KSTAT_LAT_PCPU_UPDATE(struct kstat_lat_pcpu_struct *p)
*/
cur->maxlat = 0;
- p->last.count += snap.count;
- p->last.totlat += snap.totlat;
- if (p->last.maxlat[0] < snap.maxlat)
- p->last.maxlat[0] = snap.maxlat;
+ count += snap.count;
+ totlat += snap.totlat;
+ if (maxlat < snap.maxlat)
+ maxlat = snap.maxlat;
}
- m = (p->last.maxlat[0] > p->max_snap ? p->last.maxlat[0] : p->max_snap);
+ m = (maxlat > p->max_snap ? maxlat : p->max_snap);
p->avg[0] = calc_load(p->avg[0], EXP_1, m);
p->avg[1] = calc_load(p->avg[1], EXP_5, m);
p->avg[2] = calc_load(p->avg[2], EXP_15, m);
/* reset max_snap to calculate it correctly next time */
p->max_snap = 0;
+
+ p->last.count = count;
+ p->last.totlat = totlat;
+ update_maxlat(&p->last, maxlat, jiffies);
}
EXPORT_SYMBOL(KSTAT_LAT_PCPU_UPDATE);
More information about the Devel
mailing list