Merge tag 'amd-drm-fixes-5.9-2020-08-20' of git://people.freedesktop.org/~agd5f/linux...
[linux-2.6-microblaze.git] / mm / vmstat.c
index 2b866cb..e670f91 100644 (file)
@@ -1096,6 +1096,24 @@ static int __fragmentation_index(unsigned int order, struct contig_page_info *in
        return 1000 - div_u64( (1000+(div_u64(info->free_pages * 1000ULL, requested))), info->free_blocks_total);
 }
 
+/*
+ * Calculates external fragmentation within a zone wrt the given order.
+ * It is defined as the percentage of pages found in blocks of size
+ * less than 1 << order. It returns values in range [0, 100].
+ */
+unsigned int extfrag_for_order(struct zone *zone, unsigned int order)
+{
+       struct contig_page_info info;
+
+       fill_contig_page_info(zone, order, &info);
+       if (info.free_pages == 0)
+               return 0;
+
+       return div_u64((info.free_pages -
+                       (info.free_blocks_suitable << order)) * 100,
+                       info.free_pages);
+}
+
 /* Same as __fragmentation index but allocs contig_page_info on stack */
 int fragmentation_index(struct zone *zone, unsigned int order)
 {
@@ -1167,9 +1185,12 @@ const char * const vmstat_text[] = {
        "nr_isolated_anon",
        "nr_isolated_file",
        "workingset_nodes",
-       "workingset_refault",
-       "workingset_activate",
-       "workingset_restore",
+       "workingset_refault_anon",
+       "workingset_refault_file",
+       "workingset_activate_anon",
+       "workingset_activate_file",
+       "workingset_restore_anon",
+       "workingset_restore_file",
        "workingset_nodereclaim",
        "nr_anon_pages",
        "nr_mapped",
@@ -1256,6 +1277,9 @@ const char * const vmstat_text[] = {
 #ifdef CONFIG_MIGRATION
        "pgmigrate_success",
        "pgmigrate_fail",
+       "thp_migration_success",
+       "thp_migration_fail",
+       "thp_migration_split",
 #endif
 #ifdef CONFIG_COMPACTION
        "compact_migrate_scanned",
@@ -1618,12 +1642,6 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
                   zone->present_pages,
                   zone_managed_pages(zone));
 
-       /* If unpopulated, no other information is useful */
-       if (!populated_zone(zone)) {
-               seq_putc(m, '\n');
-               return;
-       }
-
        seq_printf(m,
                   "\n        protection: (%ld",
                   zone->lowmem_reserve[0]);
@@ -1631,6 +1649,12 @@ static void zoneinfo_show_print(struct seq_file *m, pg_data_t *pgdat,
                seq_printf(m, ", %ld", zone->lowmem_reserve[i]);
        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", zone_stat_name(i),
                           zone_page_state(zone, i));