linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jiang Liu <liuj97@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>
Cc: Jiang Liu <jiang.liu@huawei.com>,
	Wen Congyang <wency@cn.fujitsu.com>,
	Maciej Rutecki <maciej.rutecki@gmail.com>,
	Chris Clayton <chris2553@googlemail.com>,
	"Rafael J . Wysocki" <rjw@sisk.pl>, Mel Gorman <mgorman@suse.de>,
	Minchan Kim <minchan@kernel.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Michal Hocko <mhocko@suse.cz>, Jianguo Wu <wujianguo@huawei.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	David Howells <dhowells@redhat.com>
Subject: [RFC PATCH v1 08/33] mm/FRV: use common help functions to free reserved pages
Date: Tue,  5 Mar 2013 22:54:51 +0800	[thread overview]
Message-ID: <1362495317-32682-9-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <1362495317-32682-1-git-send-email-jiang.liu@huawei.com>

Use common help functions to free reserved pages.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: David Howells <dhowells@redhat.com>
---
 arch/frv/mm/init.c |   32 +++-----------------------------
 1 file changed, 3 insertions(+), 29 deletions(-)

diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 92e97b0..0a86dcb 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -132,11 +132,7 @@ void __init mem_init(void)
 
 #ifdef CONFIG_HIGHMEM
 	for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--) {
-		struct page *page = &mem_map[pfn];
-
-		ClearPageReserved(page);
-		init_page_count(page);
-		__free_page(page);
+		__free_reserved_page(&mem_map[pfn]);
 		totalram_pages++;
 	}
 #endif
@@ -168,21 +164,7 @@ void __init mem_init(void)
 void free_initmem(void)
 {
 #if defined(CONFIG_RAMKERNEL) && !defined(CONFIG_PROTECT_KERNEL)
-	unsigned long start, end, addr;
-
-	start = PAGE_ALIGN((unsigned long) &__init_begin);	/* round up */
-	end   = ((unsigned long) &__init_end) & PAGE_MASK;	/* round down */
-
-	/* next to check that the page we free is not a partial page */
-	for (addr = start; addr < end; addr += PAGE_SIZE) {
-		ClearPageReserved(virt_to_page(addr));
-		init_page_count(virt_to_page(addr));
-		free_page(addr);
-		totalram_pages++;
-	}
-
-	printk("Freeing unused kernel memory: %ldKiB freed (0x%lx - 0x%lx)\n",
-	       (end - start) >> 10, start, end);
+	free_initmem_default(0);
 #endif
 } /* end free_initmem() */
 
@@ -193,14 +175,6 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void __init free_initrd_mem(unsigned long start, unsigned long end)
 {
-	int pages = 0;
-	for (; start < end; start += PAGE_SIZE) {
-		ClearPageReserved(virt_to_page(start));
-		init_page_count(virt_to_page(start));
-		free_page(start);
-		totalram_pages++;
-		pages++;
-	}
-	printk("Freeing initrd memory: %dKiB freed\n", (pages * PAGE_SIZE) >> 10);
+	free_reserved_area(start, end, 0, "initrd");
 } /* end free_initrd_mem() */
 #endif
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2013-03-05 14:59 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 14:54 [RFC PATCH v1 00/33] accurately calculate pages managed by buddy system Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 01/33] mm: introduce common help functions to deal with reserved/managed pages Jiang Liu
2013-03-05 19:47   ` Sam Ravnborg
2013-03-06 17:21     ` Russell King - ARM Linux
2013-03-09  2:17     ` Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 02/33] mm/alpha: use common help functions to free reserved pages Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 03/33] mm/ARM: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 04/33] mm/avr32: " Jiang Liu
2013-03-05 16:50   ` Hans-Christian Egtvedt
2013-03-05 14:54 ` [RFC PATCH v1 05/33] mm/blackfin: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 06/33] mm/c6x: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 07/33] mm/cris: " Jiang Liu
2013-03-05 14:54 ` Jiang Liu [this message]
2013-03-05 14:54 ` [RFC PATCH v1 09/33] mm/h8300: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 10/33] mm/IA64: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 11/33] mm/m32r: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 12/33] mm/m68k: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 13/33] mm/microblaze: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 14/33] mm/MIPS: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 15/33] mm/mn10300: " Jiang Liu
2013-03-05 14:54 ` [RFC PATCH v1 16/33] mm/openrisc: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 17/33] mm/parisc: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 18/33] mm/ppc: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 19/33] mm/s390: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 20/33] mm/score: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 21/33] mm/SH: " Jiang Liu
2013-03-06  2:21   ` Paul Mundt
2013-03-05 14:55 ` [RFC PATCH v1 22/33] mm/SPARC: " Jiang Liu
2013-03-05 19:49   ` David Miller
2013-03-05 19:58   ` Sam Ravnborg
2013-03-05 22:57     ` Sam Ravnborg
2013-03-06 15:56     ` Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 23/33] mm/um: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 24/33] mm/unicore32: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 25/33] mm/x86: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 26/33] mm/xtensa: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 27/33] mm,kexec: " Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 28/33] mm: introduce free_highmem_page() helper to free highmem pages inti buddy system Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 29/33] mm: accurately calculate zone->managed_pages for highmem zones Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 30/33] mm: use a dedicated lock to protect totalram_pages and zone->managed_pages Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 31/33] mm: avoid using __free_pages_bootmem() at runtime Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 32/33] mm: correctly update zone->mamaged_pages Jiang Liu
2013-03-05 14:55 ` [RFC PATCH v1 33/33] mm: report available pages as "MemTotal" for each NUMA node Jiang Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1362495317-32682-9-git-send-email-jiang.liu@huawei.com \
    --to=liuj97@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris2553@googlemail.com \
    --cc=dhowells@redhat.com \
    --cc=jiang.liu@huawei.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maciej.rutecki@gmail.com \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=minchan@kernel.org \
    --cc=rientjes@google.com \
    --cc=rjw@sisk.pl \
    --cc=wency@cn.fujitsu.com \
    --cc=wujianguo@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).