Commit 59c82b70 authored by Joonsoo Kim's avatar Joonsoo Kim Committed by Linus Torvalds

mm/migrate: remove putback_lru_pages, fix comment on putback_movable_pages

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: default avatarJoonsoo Kim <iamjoonsoo.kim@lge.com>
Reviewed-by: default avatarWanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Rafael Aquini <aquini@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 32665f2b
...@@ -35,7 +35,6 @@ enum migrate_reason { ...@@ -35,7 +35,6 @@ enum migrate_reason {
#ifdef CONFIG_MIGRATION #ifdef CONFIG_MIGRATION
extern void putback_lru_pages(struct list_head *l);
extern void putback_movable_pages(struct list_head *l); extern void putback_movable_pages(struct list_head *l);
extern int migrate_page(struct address_space *, extern int migrate_page(struct address_space *,
struct page *, struct page *, enum migrate_mode); struct page *, struct page *, enum migrate_mode);
...@@ -59,7 +58,6 @@ extern int migrate_page_move_mapping(struct address_space *mapping, ...@@ -59,7 +58,6 @@ extern int migrate_page_move_mapping(struct address_space *mapping,
int extra_count); int extra_count);
#else #else
static inline void putback_lru_pages(struct list_head *l) {}
static inline void putback_movable_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, static inline int migrate_pages(struct list_head *l, new_page_t x,
unsigned long private, enum migrate_mode mode, int reason) unsigned long private, enum migrate_mode mode, int reason)
......
...@@ -1585,7 +1585,13 @@ static int __soft_offline_page(struct page *page, int flags) ...@@ -1585,7 +1585,13 @@ static int __soft_offline_page(struct page *page, int flags)
ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
MIGRATE_SYNC, MR_MEMORY_FAILURE); MIGRATE_SYNC, MR_MEMORY_FAILURE);
if (ret) { 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", pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
pfn, ret, page->flags); pfn, ret, page->flags);
if (ret > 0) if (ret > 0)
......
...@@ -71,29 +71,13 @@ int migrate_prep_local(void) ...@@ -71,29 +71,13 @@ int migrate_prep_local(void)
return 0; return 0;
} }
/*
* 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 * Put previously isolated pages back onto the appropriate lists
* from where they were once taken off for compaction/migration. * from where they were once taken off for compaction/migration.
* *
* This function shall be used instead of putback_lru_pages(), * This function shall be used whenever the isolated pageset has been
* whenever the isolated pageset has been built by isolate_migratepages_range() * built from lru, balloon, hugetlbfs page. See isolate_migratepages_range()
* and isolate_huge_page().
*/ */
void putback_movable_pages(struct list_head *l) void putback_movable_pages(struct list_head *l)
{ {
...@@ -1725,7 +1709,12 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, ...@@ -1725,7 +1709,12 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page, nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page,
node, MIGRATE_ASYNC, MR_NUMA_MISPLACED); node, MIGRATE_ASYNC, MR_NUMA_MISPLACED);
if (nr_remaining) { 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; isolated = 0;
} else } else
count_vm_numa_event(NUMA_PAGE_MIGRATE); count_vm_numa_event(NUMA_PAGE_MIGRATE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment