All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/6] correct and clean-up migration related stuff
@ 2013-12-13  6:53 ` Joonsoo Kim
  0 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

Changes From v2
- Drop 7th patch which try to remove result argument on page allocation
function for migration since it is wrong.
- Fix one missed word on changelog for 2nd patch, "correct failure
handling if !hugepage_migration_support()"
- Remove missed callsite for putback_lru_pages() on 4th patch
- Add Acked-by and Review-by

Here is the patchset for correcting and cleaning-up migration
related stuff. These are random correction and clean-up, so
please see each patches ;)

Thanks.

Naoya Horiguchi (1):
  mm/migrate: add comment about permanent failure path

Joonsoo Kim (5):
  mm/migrate: correct failure handling if !hugepage_migration_support()
  mm/mempolicy: correct putback method for isolate pages if failed
  mm/migrate: remove putback_lru_pages, fix comment on
    putback_movable_pages
  mm/compaction: respect ignore_skip_hint in update_pageblock_skip
  mm/migrate: remove unused function, fail_migrate_page()

 include/linux/migrate.h |    6 ------
 mm/compaction.c         |    4 ++++
 mm/memory-failure.c     |    8 +++++++-
 mm/mempolicy.c          |    2 +-
 mm/migrate.c            |   51 +++++++++++++++++++----------------------------
 5 files changed, 32 insertions(+), 39 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 0/6] correct and clean-up migration related stuff
@ 2013-12-13  6:53 ` Joonsoo Kim
  0 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

Changes From v2
- Drop 7th patch which try to remove result argument on page allocation
function for migration since it is wrong.
- Fix one missed word on changelog for 2nd patch, "correct failure
handling if !hugepage_migration_support()"
- Remove missed callsite for putback_lru_pages() on 4th patch
- Add Acked-by and Review-by

Here is the patchset for correcting and cleaning-up migration
related stuff. These are random correction and clean-up, so
please see each patches ;)

Thanks.

Naoya Horiguchi (1):
  mm/migrate: add comment about permanent failure path

Joonsoo Kim (5):
  mm/migrate: correct failure handling if !hugepage_migration_support()
  mm/mempolicy: correct putback method for isolate pages if failed
  mm/migrate: remove putback_lru_pages, fix comment on
    putback_movable_pages
  mm/compaction: respect ignore_skip_hint in update_pageblock_skip
  mm/migrate: remove unused function, fail_migrate_page()

 include/linux/migrate.h |    6 ------
 mm/compaction.c         |    4 ++++
 mm/memory-failure.c     |    8 +++++++-
 mm/mempolicy.c          |    2 +-
 mm/migrate.c            |   51 +++++++++++++++++++----------------------------
 5 files changed, 32 insertions(+), 39 deletions(-)

-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 1/6] mm/migrate: add comment about permanent failure path
  2013-12-13  6:53 ` Joonsoo Kim
@ 2013-12-13  6:53   ` Joonsoo Kim
  -1 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Let's add a comment about where the failed page goes to, which makes
code more readable.

Acked-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/mm/migrate.c b/mm/migrate.c
index 3747fcd..c6ac87a 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1123,7 +1123,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 				nr_succeeded++;
 				break;
 			default:
-				/* Permanent failure */
+				/*
+				 * Permanent failure (-EBUSY, -ENOSYS, etc.):
+				 * unlike -EAGAIN case, the failed page is
+				 * removed from migration page list and not
+				 * retried in the next outer loop.
+				 */
 				nr_failed++;
 				break;
 			}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 1/6] mm/migrate: add comment about permanent failure path
@ 2013-12-13  6:53   ` Joonsoo Kim
  0 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Let's add a comment about where the failed page goes to, which makes
code more readable.

Acked-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/mm/migrate.c b/mm/migrate.c
index 3747fcd..c6ac87a 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1123,7 +1123,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
 				nr_succeeded++;
 				break;
 			default:
-				/* Permanent failure */
+				/*
+				 * Permanent failure (-EBUSY, -ENOSYS, etc.):
+				 * unlike -EAGAIN case, the failed page is
+				 * removed from migration page list and not
+				 * retried in the next outer loop.
+				 */
 				nr_failed++;
 				break;
 			}
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/6] mm/migrate: correct failure handling if !hugepage_migration_support()
  2013-12-13  6:53 ` Joonsoo Kim
@ 2013-12-13  6:53   ` Joonsoo Kim
  -1 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

We should remove the page from the list if we fail with ENOSYS,
since migrate_pages() consider error cases except -ENOMEM and -EAGAIN
as permanent failure and it assumes that the page would be removed from
the list. Without this patch, we could overcount number of failure.

In addition, we should put back the new hugepage if
!hugepage_migration_support(). If not, we would leak hugepage memory.

Acked-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/mm/migrate.c b/mm/migrate.c
index c6ac87a..b1cfd01 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1011,7 +1011,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
 {
 	int rc = 0;
 	int *result = NULL;
-	struct page *new_hpage = get_new_page(hpage, private, &result);
+	struct page *new_hpage;
 	struct anon_vma *anon_vma = NULL;
 
 	/*
@@ -1021,9 +1021,12 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
 	 * tables or check whether the hugepage is pmd-based or not before
 	 * kicking migration.
 	 */
-	if (!hugepage_migration_support(page_hstate(hpage)))
+	if (!hugepage_migration_support(page_hstate(hpage))) {
+		putback_active_hugepage(hpage);
 		return -ENOSYS;
+	}
 
+	new_hpage = get_new_page(hpage, private, &result);
 	if (!new_hpage)
 		return -ENOMEM;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/6] mm/migrate: correct failure handling if !hugepage_migration_support()
@ 2013-12-13  6:53   ` Joonsoo Kim
  0 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

We should remove the page from the list if we fail with ENOSYS,
since migrate_pages() consider error cases except -ENOMEM and -EAGAIN
as permanent failure and it assumes that the page would be removed from
the list. Without this patch, we could overcount number of failure.

In addition, we should put back the new hugepage if
!hugepage_migration_support(). If not, we would leak hugepage memory.

Acked-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/mm/migrate.c b/mm/migrate.c
index c6ac87a..b1cfd01 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -1011,7 +1011,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
 {
 	int rc = 0;
 	int *result = NULL;
-	struct page *new_hpage = get_new_page(hpage, private, &result);
+	struct page *new_hpage;
 	struct anon_vma *anon_vma = NULL;
 
 	/*
@@ -1021,9 +1021,12 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
 	 * tables or check whether the hugepage is pmd-based or not before
 	 * kicking migration.
 	 */
-	if (!hugepage_migration_support(page_hstate(hpage)))
+	if (!hugepage_migration_support(page_hstate(hpage))) {
+		putback_active_hugepage(hpage);
 		return -ENOSYS;
+	}
 
+	new_hpage = get_new_page(hpage, private, &result);
 	if (!new_hpage)
 		return -ENOMEM;
 
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/6] mm/mempolicy: correct putback method for isolate pages if failed
  2013-12-13  6:53 ` Joonsoo Kim
@ 2013-12-13  6:53   ` Joonsoo Kim
  -1 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

queue_pages_range() isolates hugetlbfs pages and putback_lru_pages() can't
handle these. We should change it to putback_movable_pages().

Naoya said that it is worth going into stable, because it can break
in-use hugepage list.

Cc: <stable@vger.kernel.org> # 3.12
Acked-by: Rafael Aquini <aquini@redhat.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index eca4a31..6d04d37 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1318,7 +1318,7 @@ static long do_mbind(unsigned long start, unsigned long len,
 		if (nr_failed && (flags & MPOL_MF_STRICT))
 			err = -EIO;
 	} else
-		putback_lru_pages(&pagelist);
+		putback_movable_pages(&pagelist);
 
 	up_write(&mm->mmap_sem);
  mpol_out:
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/6] mm/mempolicy: correct putback method for isolate pages if failed
@ 2013-12-13  6:53   ` Joonsoo Kim
  0 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

queue_pages_range() isolates hugetlbfs pages and putback_lru_pages() can't
handle these. We should change it to putback_movable_pages().

Naoya said that it is worth going into stable, because it can break
in-use hugepage list.

Cc: <stable@vger.kernel.org> # 3.12
Acked-by: Rafael Aquini <aquini@redhat.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index eca4a31..6d04d37 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1318,7 +1318,7 @@ static long do_mbind(unsigned long start, unsigned long len,
 		if (nr_failed && (flags & MPOL_MF_STRICT))
 			err = -EIO;
 	} else
-		putback_lru_pages(&pagelist);
+		putback_movable_pages(&pagelist);
 
 	up_write(&mm->mmap_sem);
  mpol_out:
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/6] mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages
  2013-12-13  6:53 ` Joonsoo Kim
@ 2013-12-13  6:53   ` Joonsoo Kim
  -1 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

Some part of putback_lru_pages() and putback_movable_pages() is
duplicated, so it could confuse us what we should use.
We can remove putback_lru_pages() since it is not really needed now.
This makes us undestand and maintain the code more easily.

And comment on putback_movable_pages() is stale now, so fix it.

Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index f5096b5..e4671f9 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -35,7 +35,6 @@ enum migrate_reason {
 
 #ifdef CONFIG_MIGRATION
 
-extern void putback_lru_pages(struct list_head *l);
 extern void putback_movable_pages(struct list_head *l);
 extern int migrate_page(struct address_space *,
 			struct page *, struct page *, enum migrate_mode);
@@ -58,7 +57,6 @@ extern int migrate_page_move_mapping(struct address_space *mapping,
 		struct buffer_head *head, enum migrate_mode mode);
 #else
 
-static inline void putback_lru_pages(struct list_head *l) {}
 static inline void putback_movable_pages(struct list_head *l) {}
 static inline int migrate_pages(struct list_head *l, new_page_t x,
 		unsigned long private, enum migrate_mode mode, int reason)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index b7c1716..1debdea 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1569,7 +1569,13 @@ static int __soft_offline_page(struct page *page, int flags)
 		ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
 					MIGRATE_SYNC, MR_MEMORY_FAILURE);
 		if (ret) {
-			putback_lru_pages(&pagelist);
+			if (!list_empty(&pagelist)) {
+				list_del(&page->lru);
+				dec_zone_page_state(page, NR_ISOLATED_ANON +
+						page_is_file_cache(page));
+				putback_lru_page(page);
+			}
+
 			pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
 				pfn, ret, page->flags);
 			if (ret > 0)
diff --git a/mm/migrate.c b/mm/migrate.c
index b1cfd01..fa73ee3 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -71,28 +71,12 @@ int migrate_prep_local(void)
 }
 
 /*
- * Add isolated pages on the list back to the LRU under page lock
- * to avoid leaking evictable pages back onto unevictable list.
- */
-void putback_lru_pages(struct list_head *l)
-{
-	struct page *page;
-	struct page *page2;
-
-	list_for_each_entry_safe(page, page2, l, lru) {
-		list_del(&page->lru);
-		dec_zone_page_state(page, NR_ISOLATED_ANON +
-				page_is_file_cache(page));
-			putback_lru_page(page);
-	}
-}
-
-/*
  * Put previously isolated pages back onto the appropriate lists
  * from where they were once taken off for compaction/migration.
  *
- * This function shall be used instead of putback_lru_pages(),
- * whenever the isolated pageset has been built by isolate_migratepages_range()
+ * This function shall be used whenever the isolated pageset has been
+ * built from lru, balloon, hugetlbfs page. See isolate_migratepages_range()
+ * and isolate_huge_page().
  */
 void putback_movable_pages(struct list_head *l)
 {
@@ -1704,7 +1688,12 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
 	nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page,
 				     node, MIGRATE_ASYNC, MR_NUMA_MISPLACED);
 	if (nr_remaining) {
-		putback_lru_pages(&migratepages);
+		if (!list_empty(&migratepages)) {
+			list_del(&page->lru);
+			dec_zone_page_state(page, NR_ISOLATED_ANON +
+					page_is_file_cache(page));
+			putback_lru_page(page);
+		}
 		isolated = 0;
 	} else
 		count_vm_numa_event(NUMA_PAGE_MIGRATE);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/6] mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages
@ 2013-12-13  6:53   ` Joonsoo Kim
  0 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

Some part of putback_lru_pages() and putback_movable_pages() is
duplicated, so it could confuse us what we should use.
We can remove putback_lru_pages() since it is not really needed now.
This makes us undestand and maintain the code more easily.

And comment on putback_movable_pages() is stale now, so fix it.

Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index f5096b5..e4671f9 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -35,7 +35,6 @@ enum migrate_reason {
 
 #ifdef CONFIG_MIGRATION
 
-extern void putback_lru_pages(struct list_head *l);
 extern void putback_movable_pages(struct list_head *l);
 extern int migrate_page(struct address_space *,
 			struct page *, struct page *, enum migrate_mode);
@@ -58,7 +57,6 @@ extern int migrate_page_move_mapping(struct address_space *mapping,
 		struct buffer_head *head, enum migrate_mode mode);
 #else
 
-static inline void putback_lru_pages(struct list_head *l) {}
 static inline void putback_movable_pages(struct list_head *l) {}
 static inline int migrate_pages(struct list_head *l, new_page_t x,
 		unsigned long private, enum migrate_mode mode, int reason)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index b7c1716..1debdea 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1569,7 +1569,13 @@ static int __soft_offline_page(struct page *page, int flags)
 		ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
 					MIGRATE_SYNC, MR_MEMORY_FAILURE);
 		if (ret) {
-			putback_lru_pages(&pagelist);
+			if (!list_empty(&pagelist)) {
+				list_del(&page->lru);
+				dec_zone_page_state(page, NR_ISOLATED_ANON +
+						page_is_file_cache(page));
+				putback_lru_page(page);
+			}
+
 			pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
 				pfn, ret, page->flags);
 			if (ret > 0)
diff --git a/mm/migrate.c b/mm/migrate.c
index b1cfd01..fa73ee3 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -71,28 +71,12 @@ int migrate_prep_local(void)
 }
 
 /*
- * Add isolated pages on the list back to the LRU under page lock
- * to avoid leaking evictable pages back onto unevictable list.
- */
-void putback_lru_pages(struct list_head *l)
-{
-	struct page *page;
-	struct page *page2;
-
-	list_for_each_entry_safe(page, page2, l, lru) {
-		list_del(&page->lru);
-		dec_zone_page_state(page, NR_ISOLATED_ANON +
-				page_is_file_cache(page));
-			putback_lru_page(page);
-	}
-}
-
-/*
  * Put previously isolated pages back onto the appropriate lists
  * from where they were once taken off for compaction/migration.
  *
- * This function shall be used instead of putback_lru_pages(),
- * whenever the isolated pageset has been built by isolate_migratepages_range()
+ * This function shall be used whenever the isolated pageset has been
+ * built from lru, balloon, hugetlbfs page. See isolate_migratepages_range()
+ * and isolate_huge_page().
  */
 void putback_movable_pages(struct list_head *l)
 {
@@ -1704,7 +1688,12 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
 	nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page,
 				     node, MIGRATE_ASYNC, MR_NUMA_MISPLACED);
 	if (nr_remaining) {
-		putback_lru_pages(&migratepages);
+		if (!list_empty(&migratepages)) {
+			list_del(&page->lru);
+			dec_zone_page_state(page, NR_ISOLATED_ANON +
+					page_is_file_cache(page));
+			putback_lru_page(page);
+		}
 		isolated = 0;
 	} else
 		count_vm_numa_event(NUMA_PAGE_MIGRATE);
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 5/6] mm/compaction: respect ignore_skip_hint in update_pageblock_skip
  2013-12-13  6:53 ` Joonsoo Kim
@ 2013-12-13  6:53   ` Joonsoo Kim
  -1 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

update_pageblock_skip() only fits to compaction which tries to isolate by
pageblock unit. If isolate_migratepages_range() is called by CMA, it try to
isolate regardless of pageblock unit and it don't reference
get_pageblock_skip() by ignore_skip_hint. We should also respect it on
update_pageblock_skip() to prevent from setting the wrong information.

Cc: <stable@vger.kernel.org> # 3.7+
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/mm/compaction.c b/mm/compaction.c
index 805165b..f58bcd0 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -134,6 +134,10 @@ static void update_pageblock_skip(struct compact_control *cc,
 			bool migrate_scanner)
 {
 	struct zone *zone = cc->zone;
+
+	if (cc->ignore_skip_hint)
+		return;
+
 	if (!page)
 		return;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 5/6] mm/compaction: respect ignore_skip_hint in update_pageblock_skip
@ 2013-12-13  6:53   ` Joonsoo Kim
  0 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

update_pageblock_skip() only fits to compaction which tries to isolate by
pageblock unit. If isolate_migratepages_range() is called by CMA, it try to
isolate regardless of pageblock unit and it don't reference
get_pageblock_skip() by ignore_skip_hint. We should also respect it on
update_pageblock_skip() to prevent from setting the wrong information.

Cc: <stable@vger.kernel.org> # 3.7+
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/mm/compaction.c b/mm/compaction.c
index 805165b..f58bcd0 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -134,6 +134,10 @@ static void update_pageblock_skip(struct compact_control *cc,
 			bool migrate_scanner)
 {
 	struct zone *zone = cc->zone;
+
+	if (cc->ignore_skip_hint)
+		return;
+
 	if (!page)
 		return;
 
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 6/6] mm/migrate: remove unused function, fail_migrate_page()
  2013-12-13  6:53 ` Joonsoo Kim
@ 2013-12-13  6:53   ` Joonsoo Kim
  -1 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

fail_migrate_page() isn't used anywhere, so remove it.

Acked-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index e4671f9..4308018 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -41,9 +41,6 @@ extern int migrate_page(struct address_space *,
 extern int migrate_pages(struct list_head *l, new_page_t x,
 		unsigned long private, enum migrate_mode mode, int reason);
 
-extern int fail_migrate_page(struct address_space *,
-			struct page *, struct page *);
-
 extern int migrate_prep(void);
 extern int migrate_prep_local(void);
 extern int migrate_vmas(struct mm_struct *mm,
@@ -83,7 +80,6 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
 
 /* Possible settings for the migrate_page() method in address_operations */
 #define migrate_page NULL
-#define fail_migrate_page NULL
 
 #endif /* CONFIG_MIGRATION */
 
diff --git a/mm/migrate.c b/mm/migrate.c
index fa73ee3..d538404 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -550,14 +550,6 @@ void migrate_page_copy(struct page *newpage, struct page *page)
  *                    Migration functions
  ***********************************************************/
 
-/* Always fail migration. Used for mappings that are not movable */
-int fail_migrate_page(struct address_space *mapping,
-			struct page *newpage, struct page *page)
-{
-	return -EIO;
-}
-EXPORT_SYMBOL(fail_migrate_page);
-
 /*
  * Common logic to directly migrate a single page suitable for
  * pages that do not use PagePrivate/PagePrivate2.
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 6/6] mm/migrate: remove unused function, fail_migrate_page()
@ 2013-12-13  6:53   ` Joonsoo Kim
  0 siblings, 0 replies; 18+ messages in thread
From: Joonsoo Kim @ 2013-12-13  6:53 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Rafael Aquini, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li, Joonsoo Kim

fail_migrate_page() isn't used anywhere, so remove it.

Acked-by: Christoph Lameter <cl@linux.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index e4671f9..4308018 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -41,9 +41,6 @@ extern int migrate_page(struct address_space *,
 extern int migrate_pages(struct list_head *l, new_page_t x,
 		unsigned long private, enum migrate_mode mode, int reason);
 
-extern int fail_migrate_page(struct address_space *,
-			struct page *, struct page *);
-
 extern int migrate_prep(void);
 extern int migrate_prep_local(void);
 extern int migrate_vmas(struct mm_struct *mm,
@@ -83,7 +80,6 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
 
 /* Possible settings for the migrate_page() method in address_operations */
 #define migrate_page NULL
-#define fail_migrate_page NULL
 
 #endif /* CONFIG_MIGRATION */
 
diff --git a/mm/migrate.c b/mm/migrate.c
index fa73ee3..d538404 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -550,14 +550,6 @@ void migrate_page_copy(struct page *newpage, struct page *page)
  *                    Migration functions
  ***********************************************************/
 
-/* Always fail migration. Used for mappings that are not movable */
-int fail_migrate_page(struct address_space *mapping,
-			struct page *newpage, struct page *page)
-{
-	return -EIO;
-}
-EXPORT_SYMBOL(fail_migrate_page);
-
 /*
  * Common logic to directly migrate a single page suitable for
  * pages that do not use PagePrivate/PagePrivate2.
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 2/6] mm/migrate: correct failure handling if !hugepage_migration_support()
  2013-12-13  6:53   ` Joonsoo Kim
@ 2013-12-13 22:05     ` Naoya Horiguchi
  -1 siblings, 0 replies; 18+ messages in thread
From: Naoya Horiguchi @ 2013-12-13 22:05 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Andrew Morton, Mel Gorman, Rik van Riel, Rafael Aquini,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li

On Fri, Dec 13, 2013 at 03:53:27PM +0900, Joonsoo Kim wrote:
> We should remove the page from the list if we fail with ENOSYS,
> since migrate_pages() consider error cases except -ENOMEM and -EAGAIN
> as permanent failure and it assumes that the page would be removed from
> the list. Without this patch, we could overcount number of failure.
> 
> In addition, we should put back the new hugepage if
> !hugepage_migration_support(). If not, we would leak hugepage memory.
> 
> Acked-by: Christoph Lameter <cl@linux.com>
> Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Thanks,
Naoya Horiguchi

> diff --git a/mm/migrate.c b/mm/migrate.c
> index c6ac87a..b1cfd01 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1011,7 +1011,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
>  {
>  	int rc = 0;
>  	int *result = NULL;
> -	struct page *new_hpage = get_new_page(hpage, private, &result);
> +	struct page *new_hpage;
>  	struct anon_vma *anon_vma = NULL;
>  
>  	/*
> @@ -1021,9 +1021,12 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
>  	 * tables or check whether the hugepage is pmd-based or not before
>  	 * kicking migration.
>  	 */
> -	if (!hugepage_migration_support(page_hstate(hpage)))
> +	if (!hugepage_migration_support(page_hstate(hpage))) {
> +		putback_active_hugepage(hpage);
>  		return -ENOSYS;
> +	}
>  
> +	new_hpage = get_new_page(hpage, private, &result);
>  	if (!new_hpage)
>  		return -ENOMEM;
>  
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 2/6] mm/migrate: correct failure handling if !hugepage_migration_support()
@ 2013-12-13 22:05     ` Naoya Horiguchi
  0 siblings, 0 replies; 18+ messages in thread
From: Naoya Horiguchi @ 2013-12-13 22:05 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Andrew Morton, Mel Gorman, Rik van Riel, Rafael Aquini,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li

On Fri, Dec 13, 2013 at 03:53:27PM +0900, Joonsoo Kim wrote:
> We should remove the page from the list if we fail with ENOSYS,
> since migrate_pages() consider error cases except -ENOMEM and -EAGAIN
> as permanent failure and it assumes that the page would be removed from
> the list. Without this patch, we could overcount number of failure.
> 
> In addition, we should put back the new hugepage if
> !hugepage_migration_support(). If not, we would leak hugepage memory.
> 
> Acked-by: Christoph Lameter <cl@linux.com>
> Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Thanks,
Naoya Horiguchi

> diff --git a/mm/migrate.c b/mm/migrate.c
> index c6ac87a..b1cfd01 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1011,7 +1011,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
>  {
>  	int rc = 0;
>  	int *result = NULL;
> -	struct page *new_hpage = get_new_page(hpage, private, &result);
> +	struct page *new_hpage;
>  	struct anon_vma *anon_vma = NULL;
>  
>  	/*
> @@ -1021,9 +1021,12 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
>  	 * tables or check whether the hugepage is pmd-based or not before
>  	 * kicking migration.
>  	 */
> -	if (!hugepage_migration_support(page_hstate(hpage)))
> +	if (!hugepage_migration_support(page_hstate(hpage))) {
> +		putback_active_hugepage(hpage);
>  		return -ENOSYS;
> +	}
>  
> +	new_hpage = get_new_page(hpage, private, &result);
>  	if (!new_hpage)
>  		return -ENOMEM;
>  
> -- 
> 1.7.9.5
> 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/6] mm/migrate: add comment about permanent failure path
  2013-12-13  6:53   ` Joonsoo Kim
@ 2013-12-16 10:55     ` Rafael Aquini
  -1 siblings, 0 replies; 18+ messages in thread
From: Rafael Aquini @ 2013-12-16 10:55 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Andrew Morton, Mel Gorman, Rik van Riel, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li

On Fri, Dec 13, 2013 at 03:53:26PM +0900, Joonsoo Kim wrote:
> From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> 
> Let's add a comment about where the failed page goes to, which makes
> code more readable.
> 
> Acked-by: Christoph Lameter <cl@linux.com>
> Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 3747fcd..c6ac87a 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1123,7 +1123,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>  				nr_succeeded++;
>  				break;
>  			default:
> -				/* Permanent failure */
> +				/*
> +				 * Permanent failure (-EBUSY, -ENOSYS, etc.):
> +				 * unlike -EAGAIN case, the failed page is
> +				 * removed from migration page list and not
> +				 * retried in the next outer loop.
> +				 */
>  				nr_failed++;
>  				break;
>  			}

Acked-by: Rafael Aquini <aquini@redhat.com>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/6] mm/migrate: add comment about permanent failure path
@ 2013-12-16 10:55     ` Rafael Aquini
  0 siblings, 0 replies; 18+ messages in thread
From: Rafael Aquini @ 2013-12-16 10:55 UTC (permalink / raw)
  To: Joonsoo Kim
  Cc: Andrew Morton, Mel Gorman, Rik van Riel, Naoya Horiguchi,
	Christoph Lameter, Joonsoo Kim, linux-kernel, linux-mm,
	Vlastimil Babka, Zhang Yanfei, Wanpeng Li

On Fri, Dec 13, 2013 at 03:53:26PM +0900, Joonsoo Kim wrote:
> From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> 
> Let's add a comment about where the failed page goes to, which makes
> code more readable.
> 
> Acked-by: Christoph Lameter <cl@linux.com>
> Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
> Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 3747fcd..c6ac87a 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1123,7 +1123,12 @@ int migrate_pages(struct list_head *from, new_page_t get_new_page,
>  				nr_succeeded++;
>  				break;
>  			default:
> -				/* Permanent failure */
> +				/*
> +				 * Permanent failure (-EBUSY, -ENOSYS, etc.):
> +				 * unlike -EAGAIN case, the failed page is
> +				 * removed from migration page list and not
> +				 * retried in the next outer loop.
> +				 */
>  				nr_failed++;
>  				break;
>  			}

Acked-by: Rafael Aquini <aquini@redhat.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2013-12-16 10:55 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-13  6:53 [PATCH v3 0/6] correct and clean-up migration related stuff Joonsoo Kim
2013-12-13  6:53 ` Joonsoo Kim
2013-12-13  6:53 ` [PATCH v3 1/6] mm/migrate: add comment about permanent failure path Joonsoo Kim
2013-12-13  6:53   ` Joonsoo Kim
2013-12-16 10:55   ` Rafael Aquini
2013-12-16 10:55     ` Rafael Aquini
2013-12-13  6:53 ` [PATCH v3 2/6] mm/migrate: correct failure handling if !hugepage_migration_support() Joonsoo Kim
2013-12-13  6:53   ` Joonsoo Kim
2013-12-13 22:05   ` Naoya Horiguchi
2013-12-13 22:05     ` Naoya Horiguchi
2013-12-13  6:53 ` [PATCH v3 3/6] mm/mempolicy: correct putback method for isolate pages if failed Joonsoo Kim
2013-12-13  6:53   ` Joonsoo Kim
2013-12-13  6:53 ` [PATCH v3 4/6] mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages Joonsoo Kim
2013-12-13  6:53   ` Joonsoo Kim
2013-12-13  6:53 ` [PATCH v3 5/6] mm/compaction: respect ignore_skip_hint in update_pageblock_skip Joonsoo Kim
2013-12-13  6:53   ` Joonsoo Kim
2013-12-13  6:53 ` [PATCH v3 6/6] mm/migrate: remove unused function, fail_migrate_page() Joonsoo Kim
2013-12-13  6:53   ` Joonsoo Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.