linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <liwanp@linux.vnet.ibm.com>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
	Rafael Aquini <aquini@redhat.com>,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Christoph Lameter <cl@linux.com>, Joonsoo Kim <js1304@gmail.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Vlastimil Babka <vbabka@suse.cz>,
	Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Subject: Re: [PATCH v2 4/7] mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages
Date: Tue, 10 Dec 2013 10:33:38 +0800	[thread overview]
Message-ID: <52a67d8c.6966420a.7a42.555fSMTPIN_ADDED_BROKEN@mx.google.com> (raw)
In-Reply-To: <1386580248-22431-5-git-send-email-iamjoonsoo.kim@lge.com>

On Mon, Dec 09, 2013 at 06:10:45PM +0900, Joonsoo Kim wrote:
>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.
>
>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..cdafdc0 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,6 +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) {
>+		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);
>+		}
> 		putback_lru_pages(&migratepages);

You should remove this line. Otherwise,

Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

> 		isolated = 0;
> 	} else
>-- 
>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>

--
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>

  reply	other threads:[~2013-12-10  2:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-09  9:10 [PATCH v2 0/7] correct and clean-up migration related stuff Joonsoo Kim
2013-12-09  9:10 ` [PATCH v2 1/7] mm/migrate: add comment about permanent failure path Joonsoo Kim
2013-12-10  1:42   ` Wanpeng Li
2013-12-09  9:10 ` [PATCH v2 2/7] mm/migrate: correct failure handling if !hugepage_migration_support() Joonsoo Kim
2013-12-09 16:17   ` Christoph Lameter
2013-12-10  8:38     ` Joonsoo Kim
2013-12-10  2:17   ` Wanpeng Li
2013-12-10  8:45     ` Joonsoo Kim
2013-12-10  9:27       ` Wanpeng Li
2013-12-09  9:10 ` [PATCH v2 3/7] mm/mempolicy: correct putback method for isolate pages if failed Joonsoo Kim
2013-12-09 16:41   ` Rafael Aquini
2013-12-10  2:22   ` Wanpeng Li
2013-12-09  9:10 ` [PATCH v2 4/7] mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages Joonsoo Kim
2013-12-10  2:33   ` Wanpeng Li [this message]
2013-12-10  8:51     ` Joonsoo Kim
2013-12-10  9:00       ` Joonsoo Kim
2013-12-09  9:10 ` [PATCH v2 5/7] mm/compaction: respect ignore_skip_hint in update_pageblock_skip Joonsoo Kim
2013-12-10  2:50   ` Wanpeng Li
2013-12-09  9:10 ` [PATCH v2 6/7] mm/migrate: remove unused function, fail_migrate_page() Joonsoo Kim
2013-12-09 16:20   ` Christoph Lameter
2013-12-09 17:07   ` Naoya Horiguchi
2013-12-10  2:36   ` Wanpeng Li
2013-12-09  9:10 ` [PATCH v2 7/7] mm/migrate: remove result argument on page allocation function for migration Joonsoo Kim
2013-12-09 16:40   ` Christoph Lameter
2013-12-10  3:22     ` Wanpeng Li
2013-12-11  8:47     ` Joonsoo Kim
2013-12-11 16:00       ` Christoph Lameter
2013-12-12  0:07         ` Joonsoo Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52a67d8c.6966420a.7a42.555fSMTPIN_ADDED_BROKEN@mx.google.com \
    --to=liwanp@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aquini@redhat.com \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=n-horiguchi@ah.jp.nec.com \
    --cc=riel@redhat.com \
    --cc=vbabka@suse.cz \
    --cc=zhangyanfei@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox