aboutsummaryrefslogtreecommitdiffstats
path: root/mm/migrate.c
diff options
context:
space:
mode:
authorRafael Aquini <aquini@redhat.com>2012-12-11 19:02:47 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-11 20:22:27 -0500
commit5733c7d11dff44e98d2ca16617886a78086b354f (patch)
tree2d7b982297b3be46b765123fad9d7d446b4cbdb3 /mm/migrate.c
parente22504296d4f64fbbbd741602ab47ee874649c18 (diff)
mm: introduce putback_movable_pages()
The PATCH "mm: introduce compaction and migration for virtio ballooned pages" hacks around putback_lru_pages() in order to allow ballooned pages to be re-inserted on balloon page list as if a ballooned page was like a LRU page. As ballooned pages are not legitimate LRU pages, this patch introduces putback_movable_pages() to properly cope with cases where the isolated pageset contains ballooned pages and LRU pages, thus fixing the mentioned inelegant hack around putback_lru_pages(). Signed-off-by: Rafael Aquini <aquini@redhat.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Andi Kleen <andi@firstfloor.org> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Minchan Kim <minchan@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/migrate.c')
-rw-r--r--mm/migrate.c20
1 files changed, 20 insertions, 0 deletions
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