aboutsummaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/migrate.c')
-rw-r--r--mm/migrate.c29
1 files changed, 9 insertions, 20 deletions
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);