[PATCH/RFC 11/11] numa - Automatic-migration - add statistics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



AutoPage Migration -  add  vmstats

Add vmstats for auto-migration:

+ automig_tasks_migrated - number of times we scan a task's
  address space to unmap pages controlled by local allocation
  policy.
+ automig_pgs_scanned - the total number of pages scanned
  [by check_range()] for automigration.
+ automig_pgs_selected - the total number of pages selected
  [by migrate_page_add()] for auto-migration.
+ automig_pgs_failed - the number of [selected] pages that
  we were not able to unmap/migrate.

We can compute the number of pages successfully unmapped or
migrated from the last two stats above.

Also, see the migrate-on-fault vmstats for information on
subsequent lazy page migrations.

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@xxxxxx>

 include/linux/vmstat.h |    4 ++++
 mm/mempolicy.c         |   12 +++++++++++-
 mm/vmstat.c            |    6 ++++++
 3 files changed, 21 insertions(+), 1 deletion(-)

Index: linux-2.6.36-mmotm-101103-1217/include/linux/vmstat.h
===================================================================
--- linux-2.6.36-mmotm-101103-1217.orig/include/linux/vmstat.h
+++ linux-2.6.36-mmotm-101103-1217/include/linux/vmstat.h
@@ -61,6 +61,10 @@ enum vm_event_item { PGPGIN, PGPGOUT, PS
 #ifdef CONFIG_MIGRATE_ON_FAULT
 		PGLOCCHECK, PGMISPLACED, PGMIGRATED,
 #endif
+#ifdef CONFIG_AUTO_MIGRATION
+		AUTOMIG_TASKS_MIGRATED,
+		AUTOMIG_PGSCANNED, AUTOMIG_PGSELECTED, AUTOMIG_PGFAILED,
+#endif
 		NR_VM_EVENT_ITEMS
 };
 
Index: linux-2.6.36-mmotm-101103-1217/mm/vmstat.c
===================================================================
--- linux-2.6.36-mmotm-101103-1217.orig/mm/vmstat.c
+++ linux-2.6.36-mmotm-101103-1217/mm/vmstat.c
@@ -869,6 +869,12 @@ static const char * const vmstat_text[]
 	"pgmisplaced",
 	"pgmigrated",
 #endif
+#ifdef CONFIG_AUTO_MIGRATION
+	"automig_tasks_migrated",
+	"automig_pgs_scanned",
+	"automig_pgs_selected",
+	"automig_pgs_failed",
+#endif
 #endif
 };
 
Index: linux-2.6.36-mmotm-101103-1217/mm/mempolicy.c
===================================================================
--- linux-2.6.36-mmotm-101103-1217.orig/mm/mempolicy.c
+++ linux-2.6.36-mmotm-101103-1217/mm/mempolicy.c
@@ -1050,6 +1050,9 @@ static long do_get_mempolicy(int *policy
 static void migrate_page_add(struct page *page, struct list_head *pagelist,
 				unsigned long flags)
 {
+	if (is_auto_migration(flags))
+		count_vm_event(AUTOMIG_PGSCANNED);
+
 	/*
 	 * Avoid migrating a file backed page in a private mapping, or
 	 * a page that is shared with > 'migrate_max_mapcount' others
@@ -1062,6 +1065,8 @@ static void migrate_page_add(struct page
 			list_add_tail(&page->lru, pagelist);
 			inc_zone_page_state(page, NR_ISOLATED_ANON +
 					    page_is_file_cache(page));
+			if (is_auto_migration(flags))
+				count_vm_event(AUTOMIG_PGSELECTED);
 		}
 	}
 }
@@ -1096,8 +1101,12 @@ static int migrate_to_node(struct mm_str
 			err = migrate_pages_unmap_only(&pagelist);
 		else
 			err = migrate_pages(&pagelist, new_node_page, dest, 0);
-		if (err)
+		if (err) {
 			putback_lru_pages(&pagelist);
+
+			if (is_auto_migration(flags))
+				count_vm_events(AUTOMIG_PGFAILED, err);
+		}
 	}
 
 	return err;
@@ -1262,6 +1271,7 @@ void auto_migrate_task_memory(void)
 	 * we're returning to user space, so mm must be non-NULL
 	 */
 	BUG_ON(!mm);
+	count_vm_event(AUTOMIG_TASKS_MIGRATED);
 
 	if (auto_migrate_lazy(current))
 		set_lazy_migration(flags);
--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux