Re: [PATCH v2 2/2] compaction: fix COMPACTPAGEFAILED counting

Previous thread: [PATCH 00/18] Add new semantic patches and reorganize existing ones by Nicolas Palix on Tuesday, August 24, 2010 - 8:38 am. (20 messages)

Next thread: [PATCH 2.6.35.3] usbhid: USB 5543:6001 needs HID_QUIRK_MULTI_INPUT by Decio Fonini on Tuesday, August 24, 2010 - 8:39 am. (2 messages)
From: Minchan Kim
Date: Tuesday, August 24, 2010 - 8:43 am

Now update_nr_listpages doesn't have a role. That's because
lists passed is always empty just after calling migrate_pages.
The migrate_pages cleans up page list which have failed to migrate
before returning by aaa994b3.

 [PATCH] page migration: handle freeing of pages in migrate_pages()

 Do not leave pages on the lists passed to migrate_pages().  Seems that we will
 not need any postprocessing of pages.  This will simplify the handling of
 pages by the callers of migrate_pages().

At that time, we thought we don't need any postprocessing of pages.
But the situation is changed. The compaction need to know the number of
failed to migrate for COMPACTPAGEFAILED stat

This patch makes new rule for caller of migrate_pages to call putback_lru_pages.
So caller need to clean up the lists so it has a chance to postprocess the pages.
[suggested by Christoph Lameter]

Cc: Hugh Dickins <hughd@google.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Minchan Kim <minchan.kim@gmail.com>
---
 mm/memory-failure.c |    1 +
 mm/memory_hotplug.c |    2 ++
 mm/mempolicy.c      |   10 ++++++++--
 mm/migrate.c        |   12 +++++++-----
 4 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 9c26eec..5267861 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1339,6 +1339,7 @@ int soft_offline_page(struct page *page, int flags)
 		list_add(&page->lru, &pagelist);
 		ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, 0);
 		if (ret) {
+			putback_lru_pages(&pagelist);
 			pr_debug("soft offline: %#lx: migration failed %d, type %lx\n",
 				pfn, ret, page->flags);
 			if (ret > 0)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index a4cfcdc..2638079 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -731,6 +731,8 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
 		goto out;
 	/* this function ...
From: Christoph Lameter
Date: Tuesday, August 24, 2010 - 10:09 am

Acked-by: Christoph Lameter <cl@linux.com>
--

From: Wu Fengguang
Date: Tuesday, August 24, 2010 - 4:18 pm

Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
--

From: Mel Gorman
Date: Monday, August 30, 2010 - 2:56 am

Looks good and it passed basic testing.

Reviewed-by: Mel Gorman <mel@csn.ul.ie>

Thanks

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab
--

Previous thread: [PATCH 00/18] Add new semantic patches and reorganize existing ones by Nicolas Palix on Tuesday, August 24, 2010 - 8:38 am. (20 messages)

Next thread: [PATCH 2.6.35.3] usbhid: USB 5543:6001 needs HID_QUIRK_MULTI_INPUT by Decio Fonini on Tuesday, August 24, 2010 - 8:39 am. (2 messages)