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,
Richard Henderson <rth@twiddle.net>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
Matt Turner <mattst88@gmail.com>
Subject: [PATCH v2, part1 02/29] mm/alpha: use common help functions to free reserved pages
Date: Sun, 10 Mar 2013 14:26:45 +0800 [thread overview]
Message-ID: <1362896833-21104-3-git-send-email-jiang.liu@huawei.com> (raw)
In-Reply-To: <1362896833-21104-1-git-send-email-jiang.liu@huawei.com>
Use common help functions to free reserved pages.
Also include <asm/sections.h> to avoid local declarations.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
---
arch/alpha/kernel/sys_nautilus.c | 5 ++---
arch/alpha/mm/init.c | 24 +++---------------------
arch/alpha/mm/numa.c | 3 +--
3 files changed, 6 insertions(+), 26 deletions(-)
diff --git a/arch/alpha/kernel/sys_nautilus.c b/arch/alpha/kernel/sys_nautilus.c
index 4d4c046..a8b9d66 100644
--- a/arch/alpha/kernel/sys_nautilus.c
+++ b/arch/alpha/kernel/sys_nautilus.c
@@ -185,7 +185,6 @@ nautilus_machine_check(unsigned long vector, unsigned long la_ptr)
mb();
}
-extern void free_reserved_mem(void *, void *);
extern void pcibios_claim_one_bus(struct pci_bus *);
static struct resource irongate_mem = {
@@ -234,8 +233,8 @@ nautilus_init_pci(void)
if (pci_mem < memtop)
memtop = pci_mem;
if (memtop > alpha_mv.min_mem_address) {
- free_reserved_mem(__va(alpha_mv.min_mem_address),
- __va(memtop));
+ free_reserved_area((unsigned long)__va(alpha_mv.min_mem_address),
+ (unsigned long)__va(memtop), 0, NULL);
printk("nautilus_init_pci: %ldk freed\n",
(memtop - alpha_mv.min_mem_address) >> 10);
}
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 1ad6ca7..0ba85ee 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -31,6 +31,7 @@
#include <asm/console.h>
#include <asm/tlb.h>
#include <asm/setup.h>
+#include <asm/sections.h>
extern void die_if_kernel(char *,struct pt_regs *,long);
@@ -281,8 +282,6 @@ printk_memory_info(void)
{
unsigned long codesize, reservedpages, datasize, initsize, tmp;
extern int page_is_ram(unsigned long) __init;
- extern char _text, _etext, _data, _edata;
- extern char __init_begin, __init_end;
/* printk all informations */
reservedpages = 0;
@@ -318,32 +317,15 @@ mem_init(void)
#endif /* CONFIG_DISCONTIGMEM */
void
-free_reserved_mem(void *start, void *end)
-{
- void *__start = start;
- for (; __start < end; __start += PAGE_SIZE) {
- ClearPageReserved(virt_to_page(__start));
- init_page_count(virt_to_page(__start));
- free_page((long)__start);
- totalram_pages++;
- }
-}
-
-void
free_initmem(void)
{
- extern char __init_begin, __init_end;
-
- free_reserved_mem(&__init_begin, &__init_end);
- printk ("Freeing unused kernel memory: %ldk freed\n",
- (&__init_end - &__init_begin) >> 10);
+ free_initmem_default(0);
}
#ifdef CONFIG_BLK_DEV_INITRD
void
free_initrd_mem(unsigned long start, unsigned long end)
{
- free_reserved_mem((void *)start, (void *)end);
- printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
+ free_reserved_area(start, end, 0, "initrd");
}
#endif
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index 3973ae3..3388504 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -17,6 +17,7 @@
#include <asm/hwrpb.h>
#include <asm/pgalloc.h>
+#include <asm/sections.h>
pg_data_t node_data[MAX_NUMNODES];
EXPORT_SYMBOL(node_data);
@@ -325,8 +326,6 @@ void __init mem_init(void)
{
unsigned long codesize, reservedpages, datasize, initsize, pfn;
extern int page_is_ram(unsigned long) __init;
- extern char _text, _etext, _data, _edata;
- extern char __init_begin, __init_end;
unsigned long nid, i;
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
--
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>
next prev parent reply other threads:[~2013-03-10 6:30 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-10 6:26 [PATCH v2, part1 00/29] Use helper functions to simplify memory intialization code Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 01/29] mm: introduce common help functions to deal with reserved/managed pages Jiang Liu
2013-03-10 9:20 ` Geert Uytterhoeven
2013-03-11 22:17 ` Jiang Liu
2013-03-10 6:26 ` Jiang Liu [this message]
2013-03-10 6:26 ` [PATCH v2, part1 03/29] mm/ARM: use common help functions to free reserved pages Jiang Liu
2013-04-04 15:47 ` Arnd Bergmann
2013-04-06 14:07 ` Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 04/29] mm/avr32: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 05/29] mm/blackfin: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 06/29] mm/c6x: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 07/29] mm/cris: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 08/29] mm/FRV: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 09/29] mm/h8300: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 10/29] mm/IA64: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 11/29] mm/m32r: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 12/29] mm/m68k: " Jiang Liu
2013-03-10 9:21 ` Geert Uytterhoeven
2013-03-10 6:26 ` [PATCH v2, part1 13/29] mm/microblaze: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 14/29] mm/MIPS: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 15/29] mm/mn10300: " Jiang Liu
2013-03-10 6:26 ` [PATCH v2, part1 16/29] mm/openrisc: " Jiang Liu
2013-04-02 5:31 ` Jonas Bonn
2013-03-10 6:27 ` [PATCH v2, part1 17/29] mm/parisc: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 18/29] mm/ppc: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 19/29] mm/s390: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 20/29] mm/score: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 21/29] mm/SH: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 22/29] mm/SPARC: " Jiang Liu
2013-03-10 7:28 ` Sam Ravnborg
2013-03-10 6:27 ` [PATCH v2, part1 23/29] mm/um: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 24/29] mm/unicore32: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 25/29] mm/x86: " Jiang Liu
2013-03-13 5:38 ` Yasuaki Ishimatsu
2013-03-13 16:45 ` Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 26/29] mm/xtensa: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 27/29] mm/arc: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 28/29] mm/metag: " Jiang Liu
2013-03-10 6:27 ` [PATCH v2, part1 29/29] mm,kexec: " Jiang Liu
2013-03-11 5:16 ` Zhang Yanfei
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=1362896833-21104-3-git-send-email-jiang.liu@huawei.com \
--to=liuj97@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chris2553@googlemail.com \
--cc=ink@jurassic.park.msu.ru \
--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=mattst88@gmail.com \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=minchan@kernel.org \
--cc=rientjes@google.com \
--cc=rjw@sisk.pl \
--cc=rth@twiddle.net \
--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).