mm: cma: fix accounting of CMA pages placed in high memory
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 12 Feb 2013 21:46:24 +0000 (13:46 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 12 Feb 2013 22:34:00 +0000 (14:34 -0800)
The total number of low memory pages is determined as totalram_pages -
totalhigh_pages, so without this patch all CMA pageblocks placed in
highmem were accounted to low memory.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/page_alloc.c

index df2022ff0c8a1d9fb7ff13ed4cf88058999485e6..9673d96b1ba72ab5d3bff286e484adde0edd203d 100644 (file)
@@ -773,6 +773,10 @@ void __init init_cma_reserved_pageblock(struct page *page)
        set_pageblock_migratetype(page, MIGRATE_CMA);
        __free_pages(page, pageblock_order);
        totalram_pages += pageblock_nr_pages;
+#ifdef CONFIG_HIGHMEM
+       if (PageHighMem(page))
+               totalhigh_pages += pageblock_nr_pages;
+#endif
 }
 #endif