aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/migrate.h2
-rw-r--r--mm/compaction.c6
-rw-r--r--mm/migrate.c20
-rw-r--r--mm/page_alloc.c2
4 files changed, 26 insertions, 4 deletions
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index ce42847ed35f..0b5865c61efd 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -27,6 +27,7 @@ typedef struct page *new_page_t(struct page *, unsigned long private, int **);
27#ifdef CONFIG_MIGRATION 27#ifdef CONFIG_MIGRATION
28 28
29extern void putback_lru_pages(struct list_head *l); 29extern void putback_lru_pages(struct list_head *l);
30extern void putback_movable_pages(struct list_head *l);
30extern int migrate_page(struct address_space *, 31extern int migrate_page(struct address_space *,
31 struct page *, struct page *, enum migrate_mode); 32 struct page *, struct page *, enum migrate_mode);
32extern int migrate_pages(struct list_head *l, new_page_t x, 33extern int migrate_pages(struct list_head *l, new_page_t x,
@@ -50,6 +51,7 @@ extern int migrate_huge_page_move_mapping(struct address_space *mapping,
50#else 51#else
51 52
52static inline void putback_lru_pages(struct list_head *l) {} 53static inline void putback_lru_pages(struct list_head *l) {}
54static inline void putback_movable_pages(struct list_head *l) {}
53static inline int migrate_pages(struct list_head *l, new_page_t x, 55static inline int migrate_pages(struct list_head *l, new_page_t x,
54 unsigned long private, bool offlining, 56 unsigned long private, bool offlining,
55 enum migrate_mode mode) { return -ENOSYS; } 57 enum migrate_mode mode) { return -ENOSYS; }
diff --git a/mm/compaction.c b/mm/compaction.c
index 470474c03b61..d24dd2d7bad4 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -1003,7 +1003,7 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
1003 switch (isolate_migratepages(zone, cc)) { 1003 switch (isolate_migratepages(zone, cc)) {
1004 case ISOLATE_ABORT: 1004 case ISOLATE_ABORT:
1005 ret = COMPACT_PARTIAL; 1005 ret = COMPACT_PARTIAL;
1006 putback_lru_pages(&cc->migratepages); 1006 putback_movable_pages(&cc->migratepages);
1007 cc->nr_migratepages = 0; 1007 cc->nr_migratepages = 0;
1008 goto out; 1008 goto out;
1009 case ISOLATE_NONE: 1009 case ISOLATE_NONE:
@@ -1026,9 +1026,9 @@ static int compact_zone(struct zone *zone, struct compact_control *cc)
1026 trace_mm_compaction_migratepages(nr_migrate - nr_remaining, 1026 trace_mm_compaction_migratepages(nr_migrate - nr_remaining,
1027 nr_remaining); 1027 nr_remaining);
1028 1028
1029 /* Release LRU pages not migrated */ 1029 /* Release isolated pages not migrated */
1030 if (err) { 1030 if (err) {
1031 putback_lru_pages(&cc->migratepages); 1031 putback_movable_pages(&cc->migratepages);
1032 cc->nr_migratepages = 0; 1032 cc->nr_migratepages = 0;
1033 if (err == -ENOMEM) { 1033 if (err == -ENOMEM) {
1034 ret = COMPACT_PARTIAL; 1034 ret = COMPACT_PARTIAL;
diff --git a/mm/migrate.c b/mm/migrate.c
index 427343c0c296..3f675ca08279 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -80,6 +80,26 @@ void putback_lru_pages(struct list_head *l)
80 list_del(&page->lru); 80 list_del(&page->lru);
81 dec_zone_page_state(page, NR_ISOLATED_ANON + 81 dec_zone_page_state(page, NR_ISOLATED_ANON +
82 page_is_file_cache(page)); 82 page_is_file_cache(page));
83 putback_lru_page(page);
84 }
85}
86
87/*
88 * Put previously isolated pages back onto the appropriate lists
89 * from where they were once taken off for compaction/migration.
90 *
91 * This function shall be used instead of putback_lru_pages(),
92 * whenever the isolated pageset has been built by isolate_migratepages_range()
93 */
94void putback_movable_pages(struct list_head *l)
95{
96 struct page *page;
97 struct page *page2;
98
99 list_for_each_entry_safe(page, page2, l, lru) {
100 list_del(&page->lru);
101 dec_zone_page_state(page, NR_ISOLATED_ANON +
102 page_is_file_cache(page));
83 if (unlikely(balloon_page_movable(page))) 103 if (unlikely(balloon_page_movable(page)))
84 balloon_page_putback(page); 104 balloon_page_putback(page);
85 else 105 else
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 5a7b7611d4e4..d9fbac1b5030 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5761,7 +5761,7 @@ static int __alloc_contig_migrate_range(struct compact_control *cc,
5761 0, false, MIGRATE_SYNC); 5761 0, false, MIGRATE_SYNC);
5762 } 5762 }
5763 5763
5764 putback_lru_pages(&cc->migratepages); 5764 putback_movable_pages(&cc->migratepages);
5765 return ret > 0 ? 0 : ret; 5765 return ret > 0 ? 0 : ret;
5766} 5766}
5767 5767