]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - mm/vmstat.c
Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[mirror_ubuntu-artful-kernel.git] / mm / vmstat.c
index c8d15051616b4b94329af25a914ce833d221302d..f5fa1bd1eb1656cb4e608bd301c83e92f66ac3b2 100644 (file)
@@ -991,6 +991,7 @@ const char * const vmstat_text[] = {
        "pgfree",
        "pgactivate",
        "pgdeactivate",
+       "pglazyfree",
 
        "pgfault",
        "pgmajfault",
@@ -1123,8 +1124,12 @@ static void frag_stop(struct seq_file *m, void *arg)
 {
 }
 
-/* Walk all the zones in a node and print using a callback */
+/*
+ * Walk zones in a node and print using a callback.
+ * If @assert_populated is true, only use callback for zones that are populated.
+ */
 static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat,
+               bool assert_populated,
                void (*print)(struct seq_file *m, pg_data_t *, struct zone *))
 {
        struct zone *zone;
@@ -1132,7 +1137,7 @@ static void walk_zones_in_node(struct seq_file *m, pg_data_t *pgdat,
        unsigned long flags;
 
        for (zone = node_zones; zone - node_zones < MAX_NR_ZONES; ++zone) {
-               if (!populated_zone(zone))
+               if (assert_populated && !populated_zone(zone))
                        continue;
 
                spin_lock_irqsave(&zone->lock, flags);
@@ -1160,7 +1165,7 @@ static void frag_show_print(struct seq_file *m, pg_data_t *pgdat,
 static int frag_show(struct seq_file *m, void *arg)
 {
        pg_data_t *pgdat = (pg_data_t *)arg;
-       walk_zones_in_node(m, pgdat, frag_show_print);
+       walk_zones_in_node(m, pgdat, true, frag_show_print);
        return 0;
 }
 
@@ -1201,7 +1206,7 @@ static int pagetypeinfo_showfree(struct seq_file *m, void *arg)
                seq_printf(m, "%6d ", order);
        seq_putc(m, '\n');
 
-       walk_zones_in_node(m, pgdat, pagetypeinfo_showfree_print);
+       walk_zones_in_node(m, pgdat, true, pagetypeinfo_showfree_print);
 
        return 0;
 }
@@ -1253,7 +1258,7 @@ static int pagetypeinfo_showblockcount(struct seq_file *m, void *arg)
        for (mtype = 0; mtype < MIGRATE_TYPES; mtype++)
                seq_printf(m, "%12s ", migratetype_names[mtype]);
        seq_putc(m, '\n');
-       walk_zones_in_node(m, pgdat, pagetypeinfo_showblockcount_print);
+       walk_zones_in_node(m, pgdat, true, pagetypeinfo_showblockcount_print);
 
        return 0;
 }
@@ -1279,7 +1284,7 @@ static void pagetypeinfo_showmixedcount(struct seq_file *m, pg_data_t *pgdat)
                seq_printf(m, "%12s ", migratetype_names[mtype]);
        seq_putc(m, '\n');
 
-       walk_zones_in_node(m, pgdat, pagetypeinfo_showmixedcount_print);
+       walk_zones_in_node(m, pgdat, true, pagetypeinfo_showmixedcount_print);
 #endif /* CONFIG_PAGE_OWNER */
 }
 
@@ -1388,18 +1393,24 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
                   zone->present_pages,
                   zone->managed_pages);
 
-       for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
-               seq_printf(m, "\n      %-12s %lu", vmstat_text[i],
-                               zone_page_state(zone, i));
-
        seq_printf(m,
                   "\n        protection: (%ld",
                   zone->lowmem_reserve[0]);
        for (i = 1; i < ARRAY_SIZE(zone->lowmem_reserve); i++)
                seq_printf(m, ", %ld", zone->lowmem_reserve[i]);
-       seq_printf(m,
-                  ")"
-                  "\n  pagesets");
+       seq_putc(m, ')');
+
+       /* If unpopulated, no other information is useful */
+       if (!populated_zone(zone)) {
+               seq_putc(m, '\n');
+               return;
+       }
+
+       for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
+               seq_printf(m, "\n      %-12s %lu", vmstat_text[i],
+                               zone_page_state(zone, i));
+
+       seq_printf(m, "\n  pagesets");
        for_each_online_cpu(i) {
                struct per_cpu_pageset *pageset;
 
@@ -1429,12 +1440,15 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
 }
 
 /*
- * Output information about zones in @pgdat.
+ * Output information about zones in @pgdat.  All zones are printed regardless
+ * of whether they are populated or not: lowmem_reserve_ratio operates on the
+ * set of all zones and userspace would not be aware of such zones if they are
+ * suppressed here (zoneinfo displays the effect of lowmem_reserve_ratio).
  */
 static int zoneinfo_show(struct seq_file *m, void *arg)
 {
        pg_data_t *pgdat = (pg_data_t *)arg;
-       walk_zones_in_node(m, pgdat, zoneinfo_show_print);
+       walk_zones_in_node(m, pgdat, false, zoneinfo_show_print);
        return 0;
 }
 
@@ -1840,7 +1854,7 @@ static int unusable_show(struct seq_file *m, void *arg)
        if (!node_state(pgdat->node_id, N_MEMORY))
                return 0;
 
-       walk_zones_in_node(m, pgdat, unusable_show_print);
+       walk_zones_in_node(m, pgdat, true, unusable_show_print);
 
        return 0;
 }
@@ -1892,7 +1906,7 @@ static int extfrag_show(struct seq_file *m, void *arg)
 {
        pg_data_t *pgdat = (pg_data_t *)arg;
 
-       walk_zones_in_node(m, pgdat, extfrag_show_print);
+       walk_zones_in_node(m, pgdat, true, extfrag_show_print);
 
        return 0;
 }