From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752314Ab3CJIJI (ORCPT ); Sun, 10 Mar 2013 04:09:08 -0400 Received: from mail-pb0-f43.google.com ([209.85.160.43]:62967 "EHLO mail-pb0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751467Ab3CJIIm (ORCPT ); Sun, 10 Mar 2013 04:08:42 -0400 From: Jiang Liu To: Andrew Morton , David Rientjes Cc: Jiang Liu , Wen Congyang , Mel Gorman , Minchan Kim , KAMEZAWA Hiroyuki , Michal Hocko , Jianguo Wu , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Michel Lespinasse , Rik van Riel , Konstantin Khlebnikov , Marek Szyprowski , Michal Nazarewicz , Russell King , David Howells , James Hogan , Michal Simek , Ralf Baechle , David Daney , "David S. Miller" , Sam Ravnborg , Jeff Dike , Richard Weinberger , "H. Peter Anvin" Subject: [PATCH v2, part2 01/10] mm: introduce free_highmem_page() helper to free highmem pages into buddy system Date: Sun, 10 Mar 2013 16:01:01 +0800 Message-Id: <1362902470-25787-2-git-send-email-jiang.liu@huawei.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1362902470-25787-1-git-send-email-jiang.liu@huawei.com> References: <1362902470-25787-1-git-send-email-jiang.liu@huawei.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Andrew Morton Cc: Mel Gorman Cc: Michel Lespinasse Cc: Rik van Riel Cc: Konstantin Khlebnikov Cc: Minchan Kim Cc: Marek Szyprowski Cc: Michal Nazarewicz Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Cc: Russell King Cc: David Howells Cc: James Hogan Cc: Michal Simek Cc: Ralf Baechle Cc: David Daney Cc: "David S. Miller" Cc: Sam Ravnborg Cc: Jeff Dike Cc: Richard Weinberger Cc: "H. Peter Anvin" --- 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