aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/migrate.h2
-rw-r--r--mm/memory-failure.c8
-rw-r--r--mm/migrate.c29
3 files changed, 16 insertions, 23 deletions
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index f015c059e159..2a411bc0097f 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -35,7 +35,6 @@ enum migrate_reason {
35 35
36#ifdef CONFIG_MIGRATION 36#ifdef CONFIG_MIGRATION
37 37
38extern void putback_lru_pages(struct list_head *l);
39extern void putback_movable_pages(struct list_head *l); 38extern void putback_movable_pages(struct list_head *l);
40extern int migrate_page(struct address_space *, 39extern int migrate_page(struct address_space *,
41 struct page *, struct page *, enum migrate_mode); 40 struct page *, struct page *, enum migrate_mode);
@@ -59,7 +58,6 @@ extern int migrate_page_move_mapping(struct address_space *mapping,
59 int extra_count); 58 int extra_count);
60#else 59#else
61 60
62static inline void putback_lru_pages(struct list_head *l) {}
63static inline void putback_movable_pages(struct list_head *l) {} 61static inline void putback_movable_pages(struct list_head *l) {}
64static inline int migrate_pages(struct list_head *l, new_page_t x, 62static inline int migrate_pages(struct list_head *l, new_page_t x,
65 unsigned long private, enum migrate_mode mode, int reason) 63 unsigned long private, enum migrate_mode mode, int reason)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 9fa6586d5275..b25ed321e667 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1585,7 +1585,13 @@ static int __soft_offline_page(struct page *page, int flags)
1585 ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL, 1585 ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
1586 MIGRATE_SYNC, MR_MEMORY_FAILURE); 1586 MIGRATE_SYNC, MR_MEMORY_FAILURE);
1587 if (ret) { 1587 if (ret) {
1588 putback_lru_pages(&pagelist); 1588 if (!list_empty(&pagelist)) {
1589 list_del(&page->lru);
1590 dec_zone_page_state(page, NR_ISOLATED_ANON +
1591 page_is_file_cache(page));
1592 putback_lru_page(page);
1593 }
1594
1589 pr_info("soft offline: %#lx: migration failed %d, type %lx\n", 1595 pr_info("soft offline: %#lx: migration failed %d, type %lx\n",
1590 pfn, ret, page->flags); 1596 pfn, ret, page->flags);
1591 if (ret > 0) 1597 if (ret > 0)
diff --git a/mm/migrate.c b/mm/migrate.c
index 13bedcc4656b..8a73d66be102 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -72,28 +72,12 @@ int migrate_prep_local(void)
72} 72}
73 73
74/* 74/*
75 * Add isolated pages on the list back to the LRU under page lock
76 * to avoid leaking evictable pages back onto unevictable list.
77 */
78void putback_lru_pages(struct list_head *l)
79{
80 struct page *page;
81 struct page *page2;
82
83 list_for_each_entry_safe(page, page2, l, lru) {
84 list_del(&page->lru);
85 dec_zone_page_state(page, NR_ISOLATED_ANON +
86 page_is_file_cache(page));
87 putback_lru_page(page);
88 }
89}
90
91/*
92 * Put previously isolated pages back onto the appropriate lists 75 * Put previously isolated pages back onto the appropriate lists
93 * from where they were once taken off for compaction/migration. 76 * from where they were once taken off for compaction/migration.
94 * 77 *
95 * This function shall be used instead of putback_lru_pages(), 78 * This function shall be used whenever the isolated pageset has been
96 * whenever the isolated pageset has been built by isolate_migratepages_range() 79 * built from lru, balloon, hugetlbfs page. See isolate_migratepages_range()
80 * and isolate_huge_page().
97 */ 81 */
98void putback_movable_pages(struct list_head *l) 82void putback_movable_pages(struct list_head *l)
99{ 83{
@@ -1725,7 +1709,12 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma,
1725 nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page, 1709 nr_remaining = migrate_pages(&migratepages, alloc_misplaced_dst_page,
1726 node, MIGRATE_ASYNC, MR_NUMA_MISPLACED); 1710 node, MIGRATE_ASYNC, MR_NUMA_MISPLACED);
1727 if (nr_remaining) { 1711 if (nr_remaining) {
1728 putback_lru_pages(&migratepages); 1712 if (!list_empty(&migratepages)) {
1713 list_del(&page->lru);
1714 dec_zone_page_state(page, NR_ISOLATED_ANON +
1715 page_is_file_cache(page));
1716 putback_lru_page(page);
1717 }
1729 isolated = 0; 1718 isolated = 0;
1730 } else 1719 } else
1731 count_vm_numa_event(NUMA_PAGE_MIGRATE); 1720 count_vm_numa_event(NUMA_PAGE_MIGRATE);