mm: compaction: Move migration fail/success stats to migrate.c
authorMel Gorman <mgorman@suse.de>
Fri, 19 Oct 2012 09:46:20 +0000 (10:46 +0100)
committerMel Gorman <mgorman@suse.de>
Tue, 11 Dec 2012 14:28:35 +0000 (14:28 +0000)
The compact_pages_moved and compact_pagemigrate_failed events are
convenient for determining if compaction is active and to what
degree migration is succeeding but it's at the wrong level. Other
users of migration may also want to know if migration is working
properly and this will be particularly true for any automated
NUMA migration. This patch moves the counters down to migration
with the new events called pgmigrate_success and pgmigrate_fail.
The compact_blocks_moved counter is removed because while it was
useful for debugging initially, it's worthless now as no meaningful
conclusions can be drawn from its value.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.com>
include/linux/vm_event_item.h
mm/compaction.c
mm/migrate.c
mm/vmstat.c

index 3d3114594370118addc16ee1156e9b19f6d97fef..8aa7cb94b5fb50480c44830d31cbe8f553f735f2 100644 (file)
@@ -38,8 +38,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
                KSWAPD_LOW_WMARK_HIT_QUICKLY, KSWAPD_HIGH_WMARK_HIT_QUICKLY,
                KSWAPD_SKIP_CONGESTION_WAIT,
                PAGEOUTRUN, ALLOCSTALL, PGROTATED,
+#ifdef CONFIG_MIGRATION
+               PGMIGRATE_SUCCESS, PGMIGRATE_FAIL,
+#endif
 #ifdef CONFIG_COMPACTION
-               COMPACTBLOCKS, COMPACTPAGES, COMPACTPAGEFAILED,
                COMPACTSTALL, COMPACTFAIL, COMPACTSUCCESS,
 #endif
 #ifdef CONFIG_HUGETLB_PAGE
index 9eef55838fca5ff99580982e85ea0c0fa6dea839..00ad883952160838127b442c167ca35081fe5380 100644 (file)
@@ -994,10 +994,6 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
                update_nr_listpages(cc);
                nr_remaining = cc->nr_migratepages;
 
-               count_vm_event(COMPACTBLOCKS);
-               count_vm_events(COMPACTPAGES, nr_migrate - nr_remaining);
-               if (nr_remaining)
-                       count_vm_events(COMPACTPAGEFAILED, nr_remaining);
                trace_mm_compaction_migratepages(nr_migrate - nr_remaining,
                                                nr_remaining);
 
index 77ed2d7737056eea742eb29601373e7996b14432..04687f69cc173b0581b1bc0381792253ca119fcc 100644 (file)
@@ -962,6 +962,7 @@ int migrate_pages(struct list_head *from,
 {
        int retry = 1;
        int nr_failed = 0;
+       int nr_succeeded = 0;
        int pass = 0;
        struct page *page;
        struct page *page2;
@@ -988,6 +989,7 @@ int migrate_pages(struct list_head *from,
                                retry++;
                                break;
                        case 0:
+                               nr_succeeded++;
                                break;
                        default:
                                /* Permanent failure */
@@ -998,6 +1000,10 @@ int migrate_pages(struct list_head *from,
        }
        rc = 0;
 out:
+       if (nr_succeeded)
+               count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded);
+       if (nr_failed)
+               count_vm_events(PGMIGRATE_FAIL, nr_failed);
        if (!swapwrite)
                current->flags &= ~PF_SWAPWRITE;
 
index c7370579111b872943c56bd694dc0bd02121092d..89a7fd665b320977527a5da3edf893e5ffc282c8 100644 (file)
@@ -774,10 +774,11 @@ const char * const vmstat_text[] = {
 
        "pgrotated",
 
+#ifdef CONFIG_MIGRATION
+       "pgmigrate_success",
+       "pgmigrate_fail",
+#endif
 #ifdef CONFIG_COMPACTION
-       "compact_blocks_moved",
-       "compact_pages_moved",
-       "compact_pagemigrate_failed",
        "compact_stall",
        "compact_fail",
        "compact_success",