Linux NUMA userland tools development
 help / color / mirror / Atom feed
From: Lee Schermerhorn <lee.schermerhorn@hp.com>
To: linux-numa@vger.kernel.org
Cc: akpm@linux-foundation.org, Mel Gorman <mel@csn.ul.ie>,
	cl@linux-foundation.org, Nick Piggin <npiggin@kernel.dk>,
	Hugh Dickins <hughd@google.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	andi@firstfloor.org, David Rientjes <rientjes@google.com>,
	Avi Kivity <avi@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>
Subject: [PATCH/RFC 11/11] numa - Automatic-migration - add statistics
Date: Thu, 11 Nov 2010 15:02:31 -0500	[thread overview]
Message-ID: <20101111200231.12641.50254.sendpatchset@zaphod.localdomain> (raw)
In-Reply-To: <20101111200103.12641.80303.sendpatchset@zaphod.localdomain>

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@hp.com>

 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);

  parent reply	other threads:[~2010-11-11 20:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11 20:01 [PATCH/RFC 0/11] numa - Automatic-migration Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 1/11] numa - Automatic-migration - preparation, cleanup Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 2/11] numa - Automatic-migration - per cpuset automigration control Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 3/11] numa - Automatic-migration - check notify migrate pending Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 4/11] numa - Automatic-migration - ia64 " Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 5/11] numa - Automatic-migration - x86_64 " Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 6/11] numa - Automatic-migration - hook to scheduler inter-node migration Lee Schermerhorn
2010-11-11 20:01 ` [PATCH/RFC 7/11] numa - Automatic-migration - add internode migration delay Lee Schermerhorn
2010-11-11 20:02 ` [PATCH/RFC 8/11] numa - Automatic-migration - per cpuset max mapcount control Lee Schermerhorn
2010-11-11 20:02 ` [PATCH/RFC 9/11] numa - Automatic-migration - hook to migrate on fault Lee Schermerhorn
2010-11-11 20:02 ` [PATCH/RFC 10/11] numa - Automatic-migration - per proc automigrate kick control Lee Schermerhorn
2010-11-11 20:02 ` Lee Schermerhorn [this message]
2010-11-14  6:42 ` [PATCH/RFC 0/11] numa - Automatic-migration KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101111200231.12641.50254.sendpatchset@zaphod.localdomain \
    --to=lee.schermerhorn@hp.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=avi@redhat.com \
    --cc=cl@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-numa@vger.kernel.org \
    --cc=mel@csn.ul.ie \
    --cc=npiggin@kernel.dk \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox