Skip to contentSkip to conversation

mm/migrate: Introduce migrate_misplaced_page()

tip:sched/numa tip-bot for Peter Zijlstra 1 participant 1 message Sep 27, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw
Commit-ID:  03a040f6c17ab81659579ba6abe267c0562097e4
Gitweb:     http://git.kernel.org/tip/03a040f6c17ab81659579ba6abe267c0562097e4
Author:     Peter Zijlstra <[email protected]>
AuthorDate: Tue, 17 Jul 2012 22:54:51 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 26 Sep 2012 11:48:34 +0200

mm/migrate: Introduce migrate_misplaced_page()

Add migrate_misplaced_page() which deals with migrating pages from faults. This includes adding a new MIGRATE_FAULT migration mode to deal with the extra page reference required due to having to look up the page.

---
 include/linux/migrate.h      |    7 +++
 include/linux/migrate_mode.h |    3 +
 mm/migrate.c                 |   85 ++++++++++++++++++++++++++++++++++++++----
 3 files changed, 87 insertions(+), 8 deletions(-)
include/linux/migrate.h +7 -0
index ce7e667..7544d1a 100644
@@ -30,6 +30,7 @@ extern int migrate_vmas(struct mm_struct *mm,
 extern void migrate_page_copy(struct page *newpage, struct page *page);
 extern int migrate_huge_page_move_mapping(struct address_space *mapping,
 				  struct page *newpage, struct page *page);
+extern int migrate_misplaced_page(struct mm_struct *, struct page *, int);
 #else
 
 static inline void putback_lru_pages(struct list_head *l) {}
@@ -63,5 +64,11 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
 #define migrate_page NULL
 #define fail_migrate_page NULL
 
+static inline
+int migrate_misplaced_page(struct mm_struct *mm, struct page *page, int node)
+{
+	return -EAGAIN; /* can't migrate now */
+}
 #endif /* CONFIG_MIGRATION */
+
 #endif /* _LINUX_MIGRATE_H */
include/linux/migrate_mode.h +3 -0
index ebf3d89..40b37dc 100644
@@ -6,11 +6,14 @@
  *	on most operations but not ->writepage as the potential stall time
  *	is too significant
  * MIGRATE_SYNC will block when migrating pages
+ * MIGRATE_FAULT called from the fault path to migrate-on-fault for mempolicy
+ *	this path has an extra reference count
  */
 enum migrate_mode {
 	MIGRATE_ASYNC,
 	MIGRATE_SYNC_LIGHT,
 	MIGRATE_SYNC,
+	MIGRATE_FAULT,
 };
 
 #endif		/* MIGRATE_MODE_H_INCLUDED */
mm/migrate.c +77 -8

128 lines not on this page · raw message