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 e71018a85910ff8a94cb5b454649682acda29c83
Author: Andrey Ryabinin <[email protected]>
Date:   Fri Aug 31 13:29:58 2018 +0300

    /proc/vz/latency: distinguish atomic allocations in irq from in task 
atomics.
    
    Add to /proc/vz/latency 'alocirq' allocation type which shows allocation 
latencies
    done in irq contexts. 'alocatomic' now shows atomic allocations in task 
contexts.
    Also add 'Per-CPU alloc irq' which shows per-cpu 'alocirq' numbers.
    
    Example of new output:
    
    Version: 2.6
    
    Latencies:
    Type                         Lat            Total_lat                Calls
    scheduling:                    0                    0                    0
    alocatomic:                    0                    0                27615
    aloclow:                 2000000            738000000              3166625
    alochigh:                      0                    0                    0
    aloclowmp:                     0              4000000                15677
    alochighmp:                    0                    0                    0
    alocirq:                 1000000             81000000               292975
    swap_in:                   10710              1553913                   25
    page_in:                   50850           1141057002              2092877
    
    Averages:
    Type                        Avg1                 Avg5                Avg15
    scheduling:                    0                    0                    0
    alocatomic:                    0                    0                    0
    aloclow:                  558150               313968               165801
    alochigh:                      0                    0                    0
    aloclowmp:                  5535                 9701                 4629
    alochighmp:                    0                    0                    0
    alocirq:                  309600               163409                66832
    swap_in:                   29962                18540                 7244
    page_in:                  177194                60133                29625
    
    Per-CPU alloc irq:
    Type                         Lat            Total_lat                Calls
    cpu0                           0                    0                    3
    cpu1                           0                    0                    0
    cpu2                           0                    0                    0
    cpu3                     1000000             87000000               316298
    
    https://jira.sw.ru/browse/PSBM-87797
    Signed-off-by: Andrey Ryabinin <[email protected]>
    
    Cc: Pavel Borzenkov <[email protected]>
    Reviewed-by: Denis V. Lunev <[email protected]>
    
    (cherry picked from vz7 commit 62fb4398386f ("/proc/vz/latency:
    distinguish atomic allocations in irq from in task atomics."))
    
    Signed-off-by: Konstantin Khorenko <[email protected]>
---
 include/linux/kstat.h |  1 +
 kernel/ve/vzstat.c    | 21 +++++++++++++++++++--
 mm/page_alloc.c       | 10 +++++++---
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/include/linux/kstat.h b/include/linux/kstat.h
index 97a0f9b70456..6f4ba09b74f4 100644
--- a/include/linux/kstat.h
+++ b/include/linux/kstat.h
@@ -7,6 +7,7 @@ enum {
        KSTAT_ALLOCSTAT_HIGH,
        KSTAT_ALLOCSTAT_LOW_MP,
        KSTAT_ALLOCSTAT_HIGH_MP,
+       KSTAT_ALLOCSTAT_IRQ,
        KSTAT_ALLOCSTAT_NR,
        KSTAT_SCHED = KSTAT_ALLOCSTAT_NR,
        KSTAT_NR,
diff --git a/kernel/ve/vzstat.c b/kernel/ve/vzstat.c
index 7f9fa61836a7..0180ccf685ac 100644
--- a/kernel/ve/vzstat.c
+++ b/kernel/ve/vzstat.c
@@ -10,6 +10,7 @@
 #include <linux/sched/task.h>
 #include <linux/sched/stat.h>
 #include <linux/module.h>
+#include <linux/cpu.h>
 #include <linux/mm.h>
 #include <linux/ve.h>
 #include <linux/ve_proto.h>
@@ -37,7 +38,8 @@ static const char *alloc_descr[KSTAT_ALLOCSTAT_NR] = {
        "aloclow:",
        "alochigh:",
        "aloclowmp:",
-       "alochighmp:"
+       "alochighmp:",
+       "alocirq:"
 };
 
 /*
@@ -180,11 +182,12 @@ static void avglat_seq_show(struct seq_file *m,
 static int latency_seq_show(struct seq_file *m, void *v)
 {
        int i;
+       int cpu;
 
        if (!v)
                return 0;
 
-       seq_puts(m, "Version: 2.5\n");
+       seq_puts(m, "Version: 2.6\n");
 
        seq_puts(m, "\nLatencies:\n");
        seq_printf(m, "%-11s %20s %20s %20s\n",
@@ -206,6 +209,20 @@ static int latency_seq_show(struct seq_file *m, void *v)
        avglat_seq_show(m, "swap_in:", kstat_glob.swap_in.avg);
        avglat_seq_show(m, "page_in:", kstat_glob.page_in.avg);
 
+       seq_puts(m, "\nPer-CPU alloc irq:\n");
+       seq_printf(m, "%-11s %20s %20s %20s\n",
+                       "Type", "Lat", "Total_lat", "Calls");
+
+       get_online_cpus();
+       for_each_online_cpu(cpu) {
+               struct kstat_lat_pcpu_snap_struct *snap;
+
+               snap = 
per_cpu_ptr(kstat_glob.alloc_lat[KSTAT_ALLOCSTAT_IRQ].cur, cpu);
+               seq_printf(m, "cpu%-8d %20Lu %20Lu %20lu\n", cpu,
+                       snap->maxlat, snap->totlat, snap->count);
+       }
+       put_online_cpus();
+
        return 0;
 }
 
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index b5afa2acc15a..548c4d087664 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -4561,13 +4561,17 @@ static void __alloc_collect_stats(gfp_t gfp_mask, 
unsigned int order,
 
        current_clock = sched_clock();
        delta = current_clock - time;
-       if (!(gfp_mask & __GFP_RECLAIM))
-               ind = KSTAT_ALLOCSTAT_ATOMIC;
-       else
+       if (!(gfp_mask & __GFP_RECLAIM)) {
+               if (in_task())
+                       ind = KSTAT_ALLOCSTAT_ATOMIC;
+               else
+                       ind = KSTAT_ALLOCSTAT_IRQ;
+       } else {
                if (order > 0)
                        ind = KSTAT_ALLOCSTAT_LOW_MP;
                else
                        ind = KSTAT_ALLOCSTAT_LOW;
+       }
 
        local_irq_save(flags);
        cpu = smp_processor_id();
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to