The commit is pushed to "branch-rh9-5.14.vz9.1.x-ovz" and will appear at 
https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-4.vz9.10.12
------>
commit 07790e50d4d06560b6f94707f59634c81b21be30
Author: Andrey Ryabinin <ryabinin....@gmail.com>
Date:   Wed Oct 20 11:39:27 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 <aryabi...@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.zhadche...@virtuozzo.com>
    
    (cherry-picked from vz8 commit 0007215132f6 ("/proc/vz/latency: Show max 
latency
    in 2 min instead of 5sec."))
    
    Signed-off-by: Nikita Yushchenko <nikita.yushche...@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 6e7dcf55c0fc..d5d881e6be5a 100644
--- a/kernel/ve/vzstat.c
+++ b/kernel/ve/vzstat.c
@@ -169,7 +169,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 42f4564285b4..0418625d271e 100644
--- a/kernel/ve/vzstat_core.c
+++ b/kernel/ve/vzstat_core.c
@@ -71,8 +71,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);
@@ -87,17 +88,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);
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to