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 <jiang....@huawei.com>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Mel Gorman <mgor...@suse.de>
Cc: Michel Lespinasse <wal...@google.com>
Cc: Rik van Riel <r...@redhat.com>
Cc: Konstantin Khlebnikov <khlebni...@openvz.org>
Cc: Minchan Kim <minc...@kernel.org>
Cc: Marek Szyprowski <m.szyprow...@samsung.com>
Cc: Michal Nazarewicz <min...@mina86.com>
Cc: linux...@kvack.org
Cc: linux-kernel@vger.kernel.org
Cc: Russell King <li...@arm.linux.org.uk>
Cc: David Howells <dhowe...@redhat.com>
Cc: James Hogan <james.ho...@imgtec.com>
Cc: Michal Simek <mon...@monstr.eu>
Cc: Ralf Baechle <r...@linux-mips.org>
Cc: David Daney <david.da...@cavium.com>
Cc: "David S. Miller" <da...@davemloft.net>
Cc: Sam Ravnborg <s...@ravnborg.org>
Cc: Jeff Dike <jd...@addtoit.com>
Cc: Richard Weinberger <rich...@nod.at>
Cc: "H. Peter Anvin" <h...@zytor.com>
---
 include/linux/mm.h |    7 +++++++
 mm/page_alloc.c    |    9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index d75c14b..f2fb750 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1303,6 +1303,13 @@ extern void free_initmem(void);
  */
 extern unsigned long free_reserved_area(unsigned long start, unsigned long end,
                                        int poison, char *s);
+#ifdef CONFIG_HIGHMEM
+/*
+ * Free a highmem page into the buddy system, adjusting totalhigh_pages
+ * and totalram_pages.
+ */
+extern void free_highmem_page(struct page *page);
+#endif
 
 static inline void adjust_managed_page_count(struct page *page, long count)
 {
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 0fadb09..37bc8ab 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5133,6 +5133,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
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to