+ page-migration-support-a-vma-migration-function.patch added to -mm tree

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

 



The patch titled

     page migration: Support a vma migration function

has been added to the -mm tree.  Its filename is

     page-migration-support-a-vma-migration-function.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: page migration: Support a vma migration function
From: Christoph Lameter <clameter@xxxxxxx>


Hooks for calling vma specific migration functions

With this patch a vma may define a vma->vm_ops->migrate function.  That
function may perform page migration on its own (some vmas may not contain page
structs and therefore cannot be handled by regular page migration.  Pages in a
vma may require special preparatory treatment before migration is possible
etc) .  Only mmap_sem is held when the migration function is called.  The
migrate() function gets passed two sets of nodemasks describing the source and
the target of the migration.  The flags parameter either contains

MPOL_MF_MOVE	which means that only pages used exclusively by
		the specified mm should be moved

or

MPOL_MF_MOVE_ALL which means that pages shared with other processes
		should also be moved.

The migration function returns 0 on success or an error condition.  An error
condition will prevent regular page migration from occurring.

On its own this patch cannot be included since there are no users for this
functionality.  But it seems that the uncached allocator will need this
functionality at some point.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>
Cc: Hugh Dickins <hugh@xxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 include/linux/migrate.h |   11 ++++++++++-
 include/linux/mm.h      |    2 ++
 mm/mempolicy.c          |    6 +++++-
 mm/migrate.c            |   20 ++++++++++++++++++++
 4 files changed, 37 insertions(+), 2 deletions(-)

diff -puN include/linux/migrate.h~page-migration-support-a-vma-migration-function include/linux/migrate.h
--- 25/include/linux/migrate.h~page-migration-support-a-vma-migration-function	Fri May 19 12:28:22 2006
+++ 25-akpm/include/linux/migrate.h	Fri May 19 12:28:22 2006
@@ -16,7 +16,9 @@ extern int fail_migrate_page(struct addr
 			struct page *, struct page *);
 
 extern int migrate_prep(void);
-
+extern int migrate_vmas(struct mm_struct *mm,
+		const nodemask_t *from, const nodemask_t *to,
+		unsigned long flags);
 #else
 
 static inline int isolate_lru_page(struct page *p, struct list_head *list)
@@ -30,6 +32,13 @@ static inline int migrate_pages_to(struc
 
 static inline int migrate_prep(void) { return -ENOSYS; }
 
+static inline int migrate_vmas(struct mm_struct *mm,
+		const nodemask_t *from, const nodemask_t *to,
+		unsigned long flags)
+{
+	return -ENOSYS;
+}
+
 /* Possible settings for the migrate_page() method in address_operations */
 #define migrate_page NULL
 #define fail_migrate_page NULL
diff -puN include/linux/mm.h~page-migration-support-a-vma-migration-function include/linux/mm.h
--- 25/include/linux/mm.h~page-migration-support-a-vma-migration-function	Fri May 19 12:28:22 2006
+++ 25-akpm/include/linux/mm.h	Fri May 19 12:28:22 2006
@@ -205,6 +205,8 @@ struct vm_operations_struct {
 	int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
 	struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
 					unsigned long addr);
+	int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
+		const nodemask_t *to, unsigned long flags);
 #endif
 };
 
diff -puN mm/mempolicy.c~page-migration-support-a-vma-migration-function mm/mempolicy.c
--- 25/mm/mempolicy.c~page-migration-support-a-vma-migration-function	Fri May 19 12:28:22 2006
+++ 25-akpm/mm/mempolicy.c	Fri May 19 12:28:22 2006
@@ -631,6 +631,10 @@ int do_migrate_pages(struct mm_struct *m
 
   	down_read(&mm->mmap_sem);
 
+	err = migrate_vmas(mm, from_nodes, to_nodes, flags);
+	if (err)
+		goto out;
+
 /*
  * Find a 'source' bit set in 'tmp' whose corresponding 'dest'
  * bit in 'to' is not also set in 'tmp'.  Clear the found 'source'
@@ -690,7 +694,7 @@ int do_migrate_pages(struct mm_struct *m
 		if (err < 0)
 			break;
 	}
-
+out:
 	up_read(&mm->mmap_sem);
 	if (err < 0)
 		return err;
diff -puN mm/migrate.c~page-migration-support-a-vma-migration-function mm/migrate.c
--- 25/mm/migrate.c~page-migration-support-a-vma-migration-function	Fri May 19 12:28:22 2006
+++ 25-akpm/mm/migrate.c	Fri May 19 12:28:22 2006
@@ -894,3 +894,23 @@ out2:
 }
 #endif
 
+/*
+ * Call migration functions in the vma_ops that may prepare
+ * memory in a vm for migration. migration functions may perform
+ * the migration for vmas that do not have an underlying page struct.
+ */
+int migrate_vmas(struct mm_struct *mm, const nodemask_t *to,
+	const nodemask_t *from, unsigned long flags)
+{
+ 	struct vm_area_struct *vma;
+ 	int err = 0;
+
+ 	for(vma = mm->mmap; vma->vm_next && !err; vma = vma->vm_next) {
+ 		if (vma->vm_ops && vma->vm_ops->migrate) {
+ 			err = vma->vm_ops->migrate(vma, to, from, flags);
+ 			if (err)
+ 				break;
+ 		}
+ 	}
+ 	return err;
+}
_

Patches currently in -mm which might be from clameter@xxxxxxx are

origin.patch
page-migration-make-do_swap_page-redo-the-fault.patch
slab-extract-cache_free_alien-from-__cache_free.patch
migration-remove-unnecessary-pageswapcache-checks.patch
page-migration-cleanup-rename-ignrefs-to-migration.patch
page-migration-cleanup-group-functions.patch
page-migration-cleanup-remove-useless-definitions.patch
page-migration-cleanup-drop-nr_refs-in-remove_references.patch
page-migration-cleanup-extract-try_to_unmap-from-migration-functions.patch
page-migration-cleanup-extract-try_to_unmap-from-migration-functions-update-comments-7.patch
page-migration-cleanup-pass-mapping-to-migration-functions.patch
page-migration-cleanup-move-fallback-handling-into-special-function.patch
page-migration-cleanup-move-fallback-handling-into-special-function-update-comments-9.patch
swapless-pm-add-r-w-migration-entries.patch
swapless-pm-add-r-w-migration-entries-ifdefs.patch
swapless-pm-add-r-w-migration-entries-update-comments.patch
swapless-pm-add-r-w-migration-entries-update-comments-4.patch
swapless-pm-add-r-w-migration-entries-update-comments-6.patch
swapless-page-migration-rip-out-swap-based-logic.patch
swapless-page-migration-modify-core-logic.patch
swapless-page-migration-modify-core-logic-remove-useless-mapping-checks.patch
more-page-migration-do-not-inc-dec-rss-counters.patch
more-page-migration-use-migration-entries-for-file-pages.patch
more-page-migration-use-migration-entries-for-file-pages-fix.patch
more-page-migration-use-migration-entries-for-file-pages-update-comments-5.patch
more-page-migration-use-migration-entries-for-file-pages-update-comments-8.patch
more-page-migration-use-migration-entries-for-file-pages-remove_migration_ptes.patch
more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2.patch
page-migration-update-documentation.patch
page-migration-simplify-migrate_pages.patch
page-migration-simplify-migrate_pages-tweaks.patch
page-migration-handle-freeing-of-pages-in-migrate_pages.patch
page-migration-use-allocator-function-for-migrate_pages.patch
page-migration-support-moving-of-individual-pages.patch
page-migration-detailed-status-for-moving-of-individual-pages.patch
page-migration-support-a-vma-migration-function.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux