From cfa11e08ed39eb28a9eff9a907b20913020c69b5 Mon Sep 17 00:00:00 2001 From: Jiang Liu Date: Mon, 29 Apr 2013 15:07:00 -0700 Subject: mm: introduce free_highmem_page() helper to free highmem pages into buddy system The original goal of this patchset is to fix the bug reported by https://bugzilla.kernel.org/show_bug.cgi?id=53501 Now it has also been expanded to reduce common code used by memory initializion. This is the second part, which applies to the previous part at: http://marc.info/?l=linux-mm&m=136289696323825&w=2 It introduces a helper function free_highmem_page() to free highmem pages into the buddy system when initializing mm subsystem. Introduction of free_highmem_page() is one step forward to clean up accesses and modificaitons of totalhigh_pages, totalram_pages and zone->managed_pages etc. I hope we could remove all references to totalhigh_pages from the arch/ subdirectory. We have only tested these patchset on x86 platforms, and have done basic compliation tests using cross-compilers from ftp.kernel.org. That means some code may not pass compilation on some architectures. So any help to test this patchset are welcomed! There are several other parts still under development: Part3: refine code to manage totalram_pages, totalhigh_pages and zone->managed_pages Part4: introduce helper functions to simplify mem_init() and remove the global variable num_physpages. This patch: Introduce helper function free_highmem_page(), which will be used by architectures with HIGHMEM enabled to free highmem pages into the buddy system. Signed-off-by: Jiang Liu Cc: "David S. Miller" Cc: "H. Peter Anvin" Cc: "Suzuki K. Poulose" Cc: Alexander Graf Cc: Arnd Bergmann Cc: Attilio Rao Cc: Benjamin Herrenschmidt Cc: Cong Wang Cc: David Daney Cc: David Howells Cc: Geert Uytterhoeven Cc: Ingo Molnar Cc: James Hogan Cc: Jeff Dike Cc: Jiang Liu Cc: Jiang Liu Cc: Konrad Rzeszutek Wilk Cc: Konstantin Khlebnikov Cc: Linus Walleij Cc: Marek Szyprowski Cc: Mel Gorman Cc: Michal Nazarewicz Cc: Michal Simek Cc: Michel Lespinasse Cc: Minchan Kim Cc: Paul Mackerras Cc: Ralf Baechle Cc: Richard Weinberger Cc: Rik van Riel Cc: Russell King Cc: Sam Ravnborg Cc: Stephen Boyd Cc: Thomas Gleixner Cc: Yinghai Lu Reviewed-by: Pekka Enberg Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/page_alloc.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mm') diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 5c660f5ba3d3..72da11c6804d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5141,6 +5141,15 @@ unsigned long free_reserved_area(unsigned long start, unsigned long end, return pages; } +#ifdef CONFIG_HIGHMEM +void free_highmem_page(struct page *page) +{ + __free_reserved_page(page); + totalram_pages++; + totalhigh_pages++; +} +#endif + /** * set_dma_reserve - set the specified number of pages reserved in the first zone * @new_dma_reserve: The number of pages to mark reserved -- cgit v1.2.3-59-g8ed1b