- more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2.patch removed from -mm tree

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

 



The patch titled

     page migration: Replace call to pageout() with writepage()

has been removed from the -mm tree.  Its filename is

     more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2.patch

This patch was probably dropped from -mm because
it has now been merged into a subsystem tree or
into Linus's tree, or because it was folded into
its parent patch in the -mm tree.

------------------------------------------------------
Subject: page migration: Replace call to pageout() with writepage()
From: Christoph Lameter <clameter@xxxxxxx>


Migration cannot use pageout for fallback since the migration entries have to
be removed before calling writepage.  writepage (and therefore pageout) may
drop the lock and expose migration entries.  Removing migration entries in
turn increases the mapcount which results in pageout() not writing out the
page.  sigh.

This problem was re-introduced with the use of migration entries for file
backed pages.

Implement our own writeout() function (this approach was posted already last
week but not included in the patch reorg) and undo the export of pageout()
since page migration was the only user of pageout().

Also remove a definition for remove_vma_swap() that was somehow left over from
earlier changes.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 include/linux/swap.h |   15 ---------
 mm/migrate.c         |   65 ++++++++++++++++++++++++++++++-----------
 mm/vmscan.c          |   14 ++++++++
 3 files changed, 61 insertions(+), 33 deletions(-)

diff -puN include/linux/swap.h~more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2 include/linux/swap.h
--- devel/include/linux/swap.h~more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2	2006-05-11 15:18:47.000000000 -0700
+++ devel-akpm/include/linux/swap.h	2006-05-11 15:18:47.000000000 -0700
@@ -186,20 +186,6 @@ extern unsigned long shrink_all_memory(u
 extern int vm_swappiness;
 extern int remove_mapping(struct address_space *mapping, struct page *page);
 
-/* possible outcome of pageout() */
-typedef enum {
-	/* failed to write page out, page is locked */
-	PAGE_KEEP,
-	/* move page to the active list, page is locked */
-	PAGE_ACTIVATE,
-	/* page has been sent to the disk successfully, page is unlocked */
-	PAGE_SUCCESS,
-	/* page is clean and locked */
-	PAGE_CLEAN,
-} pageout_t;
-
-extern pageout_t pageout(struct page *page, struct address_space *mapping);
-
 #ifdef CONFIG_NUMA
 extern int zone_reclaim_mode;
 extern int zone_reclaim_interval;
@@ -261,7 +247,6 @@ extern int remove_exclusive_swap_page(st
 struct backing_dev_info;
 
 extern spinlock_t swap_lock;
-extern int remove_vma_swap(struct vm_area_struct *vma, struct page *page);
 
 /* linux/mm/thrash.c */
 extern struct mm_struct * swap_token_mm;
diff -puN mm/migrate.c~more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2 mm/migrate.c
--- devel/mm/migrate.c~more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2	2006-05-11 15:18:47.000000000 -0700
+++ devel-akpm/mm/migrate.c	2006-05-11 15:18:47.000000000 -0700
@@ -24,6 +24,7 @@
 #include <linux/topology.h>
 #include <linux/cpu.h>
 #include <linux/cpuset.h>
+#include <linux/writeback.h>
 
 #include "internal.h"
 
@@ -468,28 +469,58 @@ int buffer_migrate_page(struct address_s
 EXPORT_SYMBOL(buffer_migrate_page);
 
 /*
- * Default handling if a filesystem does not provide a migration function.
+ * Writeback a page to clean the dirty state
  */
-static int fallback_migrate_page(struct address_space *mapping,
-	struct page *newpage, struct page *page)
+static int writeout(struct address_space *mapping, struct page *page)
 {
-	if (PageDirty(page)) {
-		/*
-		 * A dirty page may imply that the underlying filesystem has
-		 * the page on some queue. So the page must be clean for
-		 * migration. Writeout may mean we loose the lock and the
-		 * page state is no longer what we checked for earlier.
-		 * At this point we know that the migration attempt cannot
-		 * be successful.
-		 */
-		remove_migration_ptes(page, page);
+	struct writeback_control wbc = {
+		.sync_mode = WB_SYNC_NONE,
+		.nr_to_write = 1,
+		.range_start = 0,
+		.range_end = LLONG_MAX,
+		.nonblocking = 1,
+		.for_reclaim = 1
+	};
+	int rc;
 
-		if (pageout(page, mapping) == PAGE_SUCCESS)
-			/* unlocked. Relock */
-			lock_page(page);
+	if (!mapping->a_ops->writepage)
+		/* No write method for the address space */
+		return -EINVAL;
 
+	if (!clear_page_dirty_for_io(page))
+		/* Someone else already triggered a write */
 		return -EAGAIN;
-	}
+
+	/*
+	 * A dirty page may imply that the underlying filesystem has
+	 * the page on some queue. So the page must be clean for
+	 * migration. Writeout may mean we loose the lock and the
+	 * page state is no longer what we checked for earlier.
+	 * At this point we know that the migration attempt cannot
+	 * be successful.
+	 */
+	remove_migration_ptes(page, page);
+
+	rc = mapping->a_ops->writepage(page, &wbc);
+	if (rc < 0)
+		/* I/O Error writing */
+		return -EIO;
+
+	if (rc != AOP_WRITEPAGE_ACTIVATE)
+		/* unlocked. Relock */
+		lock_page(page);
+
+	return -EAGAIN;
+}
+
+/*
+ * Default handling if a filesystem does not provide a migration function.
+ */
+static int fallback_migrate_page(struct address_space *mapping,
+	struct page *newpage, struct page *page)
+{
+	if (PageDirty(page))
+		return writeout(mapping, page);
 
 	/*
 	 * Buffers may be managed in a filesystem specific way.
diff -puN mm/vmscan.c~more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2 mm/vmscan.c
--- devel/mm/vmscan.c~more-page-migration-use-migration-entries-for-file-pages-replace-call-to-pageout-with-writepage-2	2006-05-11 15:18:47.000000000 -0700
+++ devel-akpm/mm/vmscan.c	2006-05-11 15:18:47.000000000 -0700
@@ -291,11 +291,23 @@ static void handle_write_error(struct ad
 	unlock_page(page);
 }
 
+/* possible outcome of pageout() */
+typedef enum {
+	/* failed to write page out, page is locked */
+	PAGE_KEEP,
+	/* move page to the active list, page is locked */
+	PAGE_ACTIVATE,
+	/* page has been sent to the disk successfully, page is unlocked */
+	PAGE_SUCCESS,
+	/* page is clean and locked */
+	PAGE_CLEAN,
+} pageout_t;
+
 /*
  * pageout is called by shrink_page_list() for each dirty page.
  * Calls ->writepage().
  */
-pageout_t pageout(struct page *page, struct address_space *mapping)
+static pageout_t pageout(struct page *page, struct address_space *mapping)
 {
 	/*
 	 * If the page is dirty, only perform writeback if that write
_

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

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-pass-mapping-to-migration-functions.patch
page-migration-cleanup-move-fallback-handling-into-special-function.patch
swapless-pm-add-r-w-migration-entries.patch
swapless-pm-add-r-w-migration-entries-fix-2.patch
swapless-page-migration-rip-out-swap-based-logic.patch
swapless-page-migration-modify-core-logic.patch
more-page-migration-do-not-inc-dec-rss-counters.patch
more-page-migration-use-migration-entries-for-file-pages.patch
page-migration-update-documentation.patch
mm-remove-vm_locked-before-remap_pfn_range-and-drop-vm_shm.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-moving-of-individual-pages-fixes.patch
page-migration-support-moving-of-individual-pages-x86_64-support.patch
page-migration-support-moving-of-individual-pages-x86-support.patch
page-migration-support-a-vma-migration-function.patch
allow-migration-of-mlocked-pages.patch
cpuset-remove-extra-cpuset_zone_allowed-check-in-__alloc_pages.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