From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lee Schermerhorn Subject: [PATCH/RFC 8/8] numa - Migrate-on-Fault - add statistics Date: Thu, 11 Nov 2010 14:45:56 -0500 Message-ID: <20101111194556.12535.29339.sendpatchset@zaphod.localdomain> References: <20101111194450.12535.12611.sendpatchset@zaphod.localdomain> Return-path: In-Reply-To: <20101111194450.12535.12611.sendpatchset@zaphod.localdomain> Sender: linux-numa-owner@vger.kernel.org List-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-numa@vger.kernel.org Cc: akpm@linux-foundation.org, Mel Gorman , cl@linux-foundation.org, Nick Piggin , Hugh Dickins , KOSAKI Motohiro , andi@firstfloor.org, David Rientjes , Avi Kivity , Andrea Arcangeli PATCH Migrate-on-fault 8/8 - add statistics Count migrate-on-fault events: + pglocchecked -- page location checked for misplacement + pgmisplaced -- page misplaced -- location != policy + pgmigrated -- page successfully migrated Note: currently, pgmigrated is only counted when migrate-on-fault is configured. However, it will count all successful migrations, including "direct" migrations. This should be promoted to depend only on CONFIG_MIGRATE. Signed-off-by: Lee Schermerhorn include/linux/vmstat.h | 3 +++ mm/migrate.c | 11 +++++++++++ mm/vmstat.c | 5 +++++ 3 files changed, 19 insertions(+) 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 @@ -58,6 +58,9 @@ enum vm_event_item { PGPGIN, PGPGOUT, PS UNEVICTABLE_PGCLEARED, /* on COW, page truncate */ UNEVICTABLE_PGSTRANDED, /* unable to isolate on unlock */ UNEVICTABLE_MLOCKFREED, +#ifdef CONFIG_MIGRATE_ON_FAULT + PGLOCCHECK, PGMISPLACED, PGMIGRATED, +#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 @@ -864,6 +864,11 @@ static const char * const vmstat_text[] "unevictable_pgs_cleared", "unevictable_pgs_stranded", "unevictable_pgs_mlockfreed", +#ifdef CONFIG_MIGRATE_ON_FAULT + "pglocchecked", + "pgmisplaced", + "pgmigrated", +#endif #endif }; Index: linux-2.6.36-mmotm-101103-1217/mm/migrate.c =================================================================== --- linux-2.6.36-mmotm-101103-1217.orig/mm/migrate.c +++ linux-2.6.36-mmotm-101103-1217/mm/migrate.c @@ -34,6 +34,7 @@ #include #include #include +#include #include "internal.h" @@ -410,6 +411,14 @@ void migrate_page_copy(struct page *newp */ if (PageWriteback(newpage)) end_page_writeback(newpage); + + /* + * all successful migrations come through here. + */ +#ifdef CONFIG_MIGRATE_ON_FAULT +//TODO: promote statistics to CONFIG_MIGRATE? + count_vm_event(PGMIGRATED); +#endif } /************************************************************ @@ -1586,10 +1595,12 @@ struct page *check_migrate_misplaced_pag !page_mapping(page)->a_ops->migratepage) return page; + count_vm_event(PGLOCCHECK); misplaced = mpol_misplaced(page, vma, address, &polnid); if (!misplaced) return page; + count_vm_event(PGMISPLACED); return migrate_misplaced_page(page, vma->vm_mm, polnid, misplaced_is_interleaved(misplaced));