diff options
author | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2012-10-08 19:32:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 03:22:44 -0400 |
commit | 2139cbe627b8910ded55148f87ee10f7485408ed (patch) | |
tree | e42678cc486717e39391bfc71ca0e5671468210e /mm/page_isolation.c | |
parent | 770c8aaaf6f04a87e6765f24d497132de9152a46 (diff) |
cma: fix counting of isolated pages
Isolated free pages shouldn't be accounted to NR_FREE_PAGES counter. Fix
it by properly decreasing/increasing NR_FREE_PAGES counter in
set_migratetype_isolate()/unset_migratetype_isolate() and removing counter
adjustment for isolated pages from free_one_page() and split_free_page().
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_isolation.c')
-rw-r--r-- | mm/page_isolation.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/mm/page_isolation.c b/mm/page_isolation.c index 247d1f175739..3ca1716471bc 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c | |||
@@ -76,8 +76,12 @@ int set_migratetype_isolate(struct page *page) | |||
76 | 76 | ||
77 | out: | 77 | out: |
78 | if (!ret) { | 78 | if (!ret) { |
79 | unsigned long nr_pages; | ||
80 | |||
79 | set_pageblock_isolate(page); | 81 | set_pageblock_isolate(page); |
80 | move_freepages_block(zone, page, MIGRATE_ISOLATE); | 82 | nr_pages = move_freepages_block(zone, page, MIGRATE_ISOLATE); |
83 | |||
84 | __mod_zone_page_state(zone, NR_FREE_PAGES, -nr_pages); | ||
81 | } | 85 | } |
82 | 86 | ||
83 | spin_unlock_irqrestore(&zone->lock, flags); | 87 | spin_unlock_irqrestore(&zone->lock, flags); |
@@ -89,12 +93,14 @@ out: | |||
89 | void unset_migratetype_isolate(struct page *page, unsigned migratetype) | 93 | void unset_migratetype_isolate(struct page *page, unsigned migratetype) |
90 | { | 94 | { |
91 | struct zone *zone; | 95 | struct zone *zone; |
92 | unsigned long flags; | 96 | unsigned long flags, nr_pages; |
97 | |||
93 | zone = page_zone(page); | 98 | zone = page_zone(page); |
94 | spin_lock_irqsave(&zone->lock, flags); | 99 | spin_lock_irqsave(&zone->lock, flags); |
95 | if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) | 100 | if (get_pageblock_migratetype(page) != MIGRATE_ISOLATE) |
96 | goto out; | 101 | goto out; |
97 | move_freepages_block(zone, page, migratetype); | 102 | nr_pages = move_freepages_block(zone, page, migratetype); |
103 | __mod_zone_page_state(zone, NR_FREE_PAGES, nr_pages); | ||
98 | restore_pageblock_isolate(page, migratetype); | 104 | restore_pageblock_isolate(page, migratetype); |
99 | out: | 105 | out: |
100 | spin_unlock_irqrestore(&zone->lock, flags); | 106 | spin_unlock_irqrestore(&zone->lock, flags); |