* [PATCH v5, part4 01/41] vmlinux.lds: add comments for global variables and clean up useless declarations
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
@ 2013-05-08 15:50 ` Jiang Liu
2013-05-08 15:50 ` [PATCH v5, part4 02/41] avr32: normalize global variables exported by vmlinux.lds Jiang Liu
` (39 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:50 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Arnd Bergmann
This patch documents global variables exported from vmlinux.lds.
1) Add comments about usage guidelines for global variables exported
from vmlinux.lds.S.
2) Remove unused __initdata_begin[] and __initdata_end[].
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
include/asm-generic/sections.h | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index c1a1216..f1a24b5 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -3,6 +3,26 @@
/* References to section boundaries */
+/*
+ * Usage guidelines:
+ * _text, _data: architecture specific, don't use them in arch-independent code
+ * [_stext, _etext]: contains .text.* sections, may also contain .rodata.*
+ * and/or .init.* sections
+ * [_sdata, _edata]: contains .data.* sections, may also contain .rodata.*
+ * and/or .init.* sections.
+ * [__start_rodata, __end_rodata]: contains .rodata.* sections
+ * [__init_begin, __init_end]: contains .init.* sections, but .init.text.*
+ * may be out of this range on some architectures.
+ * [_sinittext, _einittext]: contains .init.text.* sections
+ * [__bss_start, __bss_stop]: contains BSS sections
+ *
+ * Following global variables are optional and may be unavailable on some
+ * architectures and/or kernel configurations.
+ * _text, _data
+ * __kprobes_text_start, __kprobes_text_end
+ * __entry_text_start, __entry_text_end
+ * __ctors_start, __ctors_end
+ */
extern char _text[], _stext[], _etext[];
extern char _data[], _sdata[], _edata[];
extern char __bss_start[], __bss_stop[];
@@ -12,7 +32,6 @@ extern char _end[];
extern char __per_cpu_load[], __per_cpu_start[], __per_cpu_end[];
extern char __kprobes_text_start[], __kprobes_text_end[];
extern char __entry_text_start[], __entry_text_end[];
-extern char __initdata_begin[], __initdata_end[];
extern char __start_rodata[], __end_rodata[];
/* Start and end of .ctors section - used for constructor calls. */
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 02/41] avr32: normalize global variables exported by vmlinux.lds
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
2013-05-08 15:50 ` [PATCH v5, part4 01/41] vmlinux.lds: add comments for global variables and clean up useless declarations Jiang Liu
@ 2013-05-08 15:50 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 03/41] c6x: " Jiang Liu
` (38 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:50 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Haavard Skinnemoen
Normalize global variables exported by vmlinux.lds to conform usage
guidelines from include/asm-generic/sections.h.
Use _text to mark the start of the kernel image including the head text,
and _stext to mark the start of the .text section.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: linux-kernel@vger.kernel.org
---
arch/avr32/kernel/setup.c | 2 +-
arch/avr32/kernel/vmlinux.lds.S | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/avr32/kernel/setup.c b/arch/avr32/kernel/setup.c
index b4247f4..209ae5a 100644
--- a/arch/avr32/kernel/setup.c
+++ b/arch/avr32/kernel/setup.c
@@ -555,7 +555,7 @@ void __init setup_arch (char **cmdline_p)
{
struct clk *cpu_clk;
- init_mm.start_code = (unsigned long)_text;
+ init_mm.start_code = (unsigned long)_stext;
init_mm.end_code = (unsigned long)_etext;
init_mm.end_data = (unsigned long)_edata;
init_mm.brk = (unsigned long)_end;
diff --git a/arch/avr32/kernel/vmlinux.lds.S b/arch/avr32/kernel/vmlinux.lds.S
index 9cd2bd9..a458917 100644
--- a/arch/avr32/kernel/vmlinux.lds.S
+++ b/arch/avr32/kernel/vmlinux.lds.S
@@ -23,7 +23,7 @@ SECTIONS
{
. = CONFIG_ENTRY_ADDRESS;
.init : AT(ADDR(.init) - LOAD_OFFSET) {
- _stext = .;
+ _text = .;
__init_begin = .;
_sinittext = .;
*(.text.reset)
@@ -46,7 +46,7 @@ SECTIONS
.text : AT(ADDR(.text) - LOAD_OFFSET) {
_evba = .;
- _text = .;
+ _stext = .;
*(.ex.text)
*(.irq.text)
KPROBES_TEXT
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 03/41] c6x: normalize global variables exported by vmlinux.lds
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
2013-05-08 15:50 ` [PATCH v5, part4 01/41] vmlinux.lds: add comments for global variables and clean up useless declarations Jiang Liu
2013-05-08 15:50 ` [PATCH v5, part4 02/41] avr32: normalize global variables exported by vmlinux.lds Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 04/41] h8300: " Jiang Liu
` (37 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Aurelien Jacquiot, linux-c6x-dev
Normalize global variables exported by vmlinux.lds to conform usage
guidelines from include/asm-generic/sections.h.
Use _text to mark the start of the kernel image including the head text,
and _stext to mark the start of the .text section.
This patch also fixes possible bugs due to current address layout that
[__init_begin, __init_end] is a sub-range of [_stext, _etext] and pages
within range [__init_begin, __init_end] will be freed by free_initmem().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-kernel@vger.kernel.org
---
arch/c6x/kernel/vmlinux.lds.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/c6x/kernel/vmlinux.lds.S b/arch/c6x/kernel/vmlinux.lds.S
index 1d81c4c..279d807 100644
--- a/arch/c6x/kernel/vmlinux.lds.S
+++ b/arch/c6x/kernel/vmlinux.lds.S
@@ -54,16 +54,15 @@ SECTIONS
}
. = ALIGN(PAGE_SIZE);
+ __init_begin = .;
.init :
{
- _stext = .;
_sinittext = .;
HEAD_TEXT
INIT_TEXT
_einittext = .;
}
- __init_begin = _stext;
INIT_DATA_SECTION(16)
PERCPU_SECTION(128)
@@ -74,6 +73,7 @@ SECTIONS
.text :
{
_text = .;
+ _stext = .;
TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 04/41] h8300: normalize global variables exported by vmlinux.lds
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (2 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 03/41] c6x: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 05/41] score: " Jiang Liu
` (36 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Yoshinori Sato
Generate mandatory global variables __bss_start/__bss_stop in
file vmlinux.lds.
Also remove one unused declaration of _text.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: linux-kernel@vger.kernel.org
---
arch/h8300/boot/compressed/misc.c | 1 -
arch/h8300/kernel/vmlinux.lds.S | 2 ++
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/h8300/boot/compressed/misc.c b/arch/h8300/boot/compressed/misc.c
index 51ab6cb..4a1e3dd 100644
--- a/arch/h8300/boot/compressed/misc.c
+++ b/arch/h8300/boot/compressed/misc.c
@@ -79,7 +79,6 @@ static void error(char *m);
int puts(const char *);
-extern int _text; /* Defined in vmlinux.lds.S */
extern int _end;
static unsigned long free_mem_ptr;
static unsigned long free_mem_end_ptr;
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index 03d356d..3253fed 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -132,10 +132,12 @@ SECTIONS
{
. = ALIGN(0x4) ;
__sbss = . ;
+ ___bss_start = . ;
*(.bss*)
. = ALIGN(0x4) ;
*(COMMON)
. = ALIGN(0x4) ;
+ ___bss_stop = . ;
__ebss = . ;
__end = . ;
__ramstart = .;
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 05/41] score: normalize global variables exported by vmlinux.lds
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (3 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 04/41] h8300: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 06/41] tile: " Jiang Liu
` (35 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Chen Liqin, Lennox Wu
Generate mandatory global variables _sdata in file vmlinux.lds.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
Cc: Lennox Wu <lennox.wu@gmail.com>
Cc: linux-kernel@vger.kernel.org
---
arch/score/kernel/vmlinux.lds.S | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/score/kernel/vmlinux.lds.S b/arch/score/kernel/vmlinux.lds.S
index eebcbaa..7274b5c 100644
--- a/arch/score/kernel/vmlinux.lds.S
+++ b/arch/score/kernel/vmlinux.lds.S
@@ -49,6 +49,7 @@ SECTIONS
}
. = ALIGN(16);
+ _sdata = .; /* Start of data section */
RODATA
EXCEPTION_TABLE(16)
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 06/41] tile: normalize global variables exported by vmlinux.lds
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (4 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 05/41] score: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 07/41] UML: " Jiang Liu
` (34 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Rusty Russell, Bjorn Helgaas, David S. Miller
Normalize global variables exported by vmlinux.lds to conform usage
guidelines from include/asm-generic/sections.h.
1) Use _text to mark the start of the kernel image including the head
text, and _stext to mark the start of the .text section.
2) Export mandatory global variables __init_begin and __init_end.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org
---
arch/tile/include/asm/sections.h | 2 +-
arch/tile/kernel/setup.c | 4 ++--
arch/tile/kernel/vmlinux.lds.S | 4 +++-
arch/tile/mm/init.c | 2 +-
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/tile/include/asm/sections.h b/arch/tile/include/asm/sections.h
index d062d46..7d8a935 100644
--- a/arch/tile/include/asm/sections.h
+++ b/arch/tile/include/asm/sections.h
@@ -34,7 +34,7 @@ extern char __sys_cmpxchg_grab_lock[];
extern char __start_atomic_asm_code[], __end_atomic_asm_code[];
#endif
-/* Handle the discontiguity between _sdata and _stext. */
+/* Handle the discontiguity between _sdata and _text. */
static inline int arch_is_kernel_data(unsigned long addr)
{
return addr >= (unsigned long)_sdata &&
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index 7a5aa1a..41818e3 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -307,8 +307,8 @@ static void __cpuinit store_permanent_mappings(void)
hv_store_mapping(addr, pages << PAGE_SHIFT, pa);
}
- hv_store_mapping((HV_VirtAddr)_stext,
- (uint32_t)(_einittext - _stext), 0);
+ hv_store_mapping((HV_VirtAddr)_text,
+ (uint32_t)(_einittext - _text), 0);
}
/*
diff --git a/arch/tile/kernel/vmlinux.lds.S b/arch/tile/kernel/vmlinux.lds.S
index 631f10d..a13ed90 100644
--- a/arch/tile/kernel/vmlinux.lds.S
+++ b/arch/tile/kernel/vmlinux.lds.S
@@ -27,7 +27,6 @@ SECTIONS
.intrpt1 (LOAD_OFFSET) : AT ( 0 ) /* put at the start of physical memory */
{
_text = .;
- _stext = .;
*(.intrpt1)
} :intrpt1 =0
@@ -36,6 +35,7 @@ SECTIONS
/* Now the real code */
. = ALIGN(0x20000);
+ _stext = .;
.text : AT (ADDR(.text) - LOAD_OFFSET) {
HEAD_TEXT
SCHED_TEXT
@@ -58,11 +58,13 @@ SECTIONS
#define LOAD_OFFSET PAGE_OFFSET
. = ALIGN(PAGE_SIZE);
+ __init_begin = .;
VMLINUX_SYMBOL(_sinitdata) = .;
INIT_DATA_SECTION(16) :data =0
PERCPU_SECTION(L2_CACHE_BYTES)
. = ALIGN(PAGE_SIZE);
VMLINUX_SYMBOL(_einitdata) = .;
+ __init_end = .;
_sdata = .; /* Start of data section */
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index 45ce26d..f2ac2f4 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -562,7 +562,7 @@ static void __init kernel_physical_mapping_init(pgd_t *pgd_base)
prot = ktext_set_nocache(prot);
}
- BUG_ON(address != (unsigned long)_stext);
+ BUG_ON(address != (unsigned long)_text);
pte = NULL;
for (; address < (unsigned long)_einittext;
pfn++, address += PAGE_SIZE) {
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 07/41] UML: normalize global variables exported by vmlinux.lds
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (5 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 06/41] tile: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 08/41] mm: introduce helper function mem_init_print_info() to simplify mem_init() Jiang Liu
` (33 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Jeff Dike, Richard Weinberger, Al Viro,
user-mode-linux-devel
Normalize global variables exported by vmlinux.lds to conform usage
guidelines from include/asm-generic/sections.h.
1) Use _text to mark the start of the kernel image including the head
text, and _stext to mark the start of the .text section.
2) Export mandatory global variables __bss_stop.
3) Adjust __init_begin and __init_end to avoid acrossing .text and
.data sections.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
---
arch/um/include/asm/common.lds.S | 1 -
arch/um/kernel/dyn.lds.S | 6 ++++--
arch/um/kernel/uml.lds.S | 7 +++++--
3 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S
index 4938de5..1dd5bd8 100644
--- a/arch/um/include/asm/common.lds.S
+++ b/arch/um/include/asm/common.lds.S
@@ -57,7 +57,6 @@
*(.uml.initcall.init)
__uml_initcall_end = .;
}
- __init_end = .;
SECURITY_INIT
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index fb8fd6f..adde088 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -14,8 +14,6 @@ SECTIONS
__binary_start = .;
. = ALIGN(4096); /* Init code and data */
_text = .;
- _stext = .;
- __init_begin = .;
INIT_TEXT_SECTION(PAGE_SIZE)
. = ALIGN(PAGE_SIZE);
@@ -67,6 +65,7 @@ SECTIONS
} =0x90909090
.plt : { *(.plt) }
.text : {
+ _stext = .;
TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
@@ -91,7 +90,9 @@ SECTIONS
#include <asm/common.lds.S>
+ __init_begin = .;
init.data : { INIT_DATA }
+ __init_end = .;
/* Ensure the __preinit_array_start label is properly aligned. We
could instead move the label definition inside the section, but
@@ -155,6 +156,7 @@ SECTIONS
. = ALIGN(32 / 8);
. = ALIGN(32 / 8);
}
+ __bss_stop = .;
_end = .;
PROVIDE (end = .);
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index ff65fb4..6899195 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -20,13 +20,12 @@ SECTIONS
. = START + SIZEOF_HEADERS;
_text = .;
- _stext = .;
- __init_begin = .;
INIT_TEXT_SECTION(0)
. = ALIGN(PAGE_SIZE);
.text :
{
+ _stext = .;
TEXT_TEXT
SCHED_TEXT
LOCK_TEXT
@@ -62,7 +61,10 @@ SECTIONS
#include <asm/common.lds.S>
+ __init_begin = .;
init.data : { INIT_DATA }
+ __init_end = .;
+
.data :
{
INIT_TASK_DATA(KERNEL_STACK_SIZE)
@@ -97,6 +99,7 @@ SECTIONS
PROVIDE(_bss_start = .);
SBSS(0)
BSS(0)
+ __bss_stop = .;
_end = .;
PROVIDE (end = .);
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 08/41] mm: introduce helper function mem_init_print_info() to simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (6 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 07/41] UML: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 09/41] mm: use totalram_pages instead of num_physpages at runtime Jiang Liu
` (32 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Michel Lespinasse, Rik van Riel, Marek Szyprowski
Introduce helper function mem_init_print_info() to simplify mem_init()
across different architectures, which also unifies the format and
information printed.
Function mem_init_print_info() calculates memory statistics information
without walking each page, so it should be a little faster on some
architectures.
Also introduce another helper get_num_physpages() to kill the global
variable num_physpages.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michel Lespinasse <walken@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
---
include/linux/mm.h | 12 ++++++++++++
mm/page_alloc.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 86014c9..66e5fb8 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1313,6 +1313,7 @@ extern void free_highmem_page(struct page *page);
#endif
extern void adjust_managed_page_count(struct page *page, long count);
+extern void mem_init_print_info(const char *str);
/* Free the reserved page into the buddy system, so it gets managed. */
static inline void __free_reserved_page(struct page *page)
@@ -1349,6 +1350,17 @@ static inline unsigned long free_initmem_default(int poison)
poison, "unused kernel");
}
+static inline unsigned long get_num_physpages(void)
+{
+ int nid;
+ unsigned long phys_pages = 0;
+
+ for_each_online_node(nid)
+ phys_pages += node_present_pages(nid);
+
+ return phys_pages;
+}
+
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
/*
* With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index d49cb72..4f0ec15 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -61,6 +61,7 @@
#include <linux/hugetlb.h>
#include <linux/sched/rt.h>
+#include <asm/sections.h>
#include <asm/tlbflush.h>
#include <asm/div64.h>
#include "internal.h"
@@ -5225,6 +5226,57 @@ void free_highmem_page(struct page *page)
}
#endif
+
+void __init mem_init_print_info(const char *str)
+{
+ unsigned long physpages, codesize, datasize, rosize;
+ unsigned long init_code_size, init_data_size;
+
+ physpages = get_num_physpages();
+ codesize = _etext - _stext;
+ datasize = _edata - _sdata;
+ rosize = __end_rodata - __start_rodata;
+ init_data_size = __init_end - __init_begin;
+ init_code_size = _einittext - _sinittext;
+
+ /*
+ * Detect special cases and adjust section sizes accordingly:
+ * 1) .init.* may be embedded into .data sections
+ * 2) .init.text.* may be out of [__init_begin, __init_end],
+ * please refer to arch/tile/kernel/vmlinux.lds.S.
+ * 3) .rodata.* may be embedded into .text or .data sections.
+ */
+#define adj_init_size(start, end, size, pos, adj) \
+ if (start <= pos && pos < end && size > adj) \
+ size -= adj;
+
+ adj_init_size(__init_begin, __init_end, init_data_size,
+ _sinittext, init_code_size);
+ adj_init_size(_stext, _etext, codesize, _sinittext, init_code_size);
+ adj_init_size(_sdata, _edata, datasize, __init_begin, init_data_size);
+ adj_init_size(_stext, _etext, codesize, __start_rodata, rosize);
+ adj_init_size(_sdata, _edata, datasize, __start_rodata, rosize);
+
+#undef adj_init_size
+
+ printk("Memory: %luK/%luK available "
+ "(%luK kernel code, %luK rwdata, %luK rodata, "
+ "%luK init, %luK bss, %luK reserved"
+#ifdef CONFIG_HIGHMEM
+ ", %luK highmem"
+#endif
+ "%s%s)\n",
+ nr_free_pages() << (PAGE_SHIFT-10), physpages << (PAGE_SHIFT-10),
+ codesize >> 10, datasize >> 10, rosize >> 10,
+ (init_data_size + init_code_size) >> 10,
+ (__bss_stop - __bss_start) >> 10,
+ (physpages - totalram_pages) << (PAGE_SHIFT-10),
+#ifdef CONFIG_HIGHMEM
+ totalhigh_pages << (PAGE_SHIFT-10),
+#endif
+ str ? ", " : "", str ? str : "");
+}
+
/**
* 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, 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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 09/41] mm: use totalram_pages instead of num_physpages at runtime
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (7 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 08/41] mm: introduce helper function mem_init_print_info() to simplify mem_init() Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 10/41] mm/hotplug: prepare for removing num_physpages Jiang Liu
` (31 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Miklos Szeredi, David S. Miller, Alexey Kuznetsov,
James Morris, Hideaki YOSHIFUJI, Patrick McHardy, fuse-devel,
netdev
The global variable num_physpages is scheduled to be removed, so use
totalram_pages instead of num_physpages at runtime.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
Cc: James Morris <jmorris@namei.org>
Cc: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: fuse-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
---
fs/fuse/inode.c | 2 +-
kernel/power/snapshot.c | 4 ++--
net/ipv4/inet_fragment.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 17ec1f7..cd6dc27 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -785,7 +785,7 @@ static const struct super_operations fuse_super_operations = {
static void sanitize_global_limit(unsigned *limit)
{
if (*limit == 0)
- *limit = ((num_physpages << PAGE_SHIFT) >> 13) /
+ *limit = ((totalram_pages << PAGE_SHIFT) >> 13) /
sizeof(struct fuse_req);
if (*limit >= 1 << 16)
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 0de2857..8b5d1cd 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -1651,7 +1651,7 @@ unsigned long snapshot_get_image_size(void)
static int init_header(struct swsusp_info *info)
{
memset(info, 0, sizeof(struct swsusp_info));
- info->num_physpages = num_physpages;
+ info->num_physpages = get_num_physpages();
info->image_pages = nr_copy_pages;
info->pages = snapshot_get_image_size();
info->size = info->pages;
@@ -1795,7 +1795,7 @@ static int check_header(struct swsusp_info *info)
char *reason;
reason = check_image_kernel(info);
- if (!reason && info->num_physpages != num_physpages)
+ if (!reason && info->num_physpages != get_num_physpages())
reason = "memory size";
if (reason) {
printk(KERN_ERR "PM: Image mismatch: %s\n", reason);
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index e97d66a..f90079d 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -93,7 +93,7 @@ void inet_frags_init(struct inet_frags *f)
}
rwlock_init(&f->lock);
- f->rnd = (u32) ((num_physpages ^ (num_physpages>>7)) ^
+ f->rnd = (u32) ((totalram_pages ^ (totalram_pages >> 7)) ^
(jiffies ^ (jiffies >> 6)));
setup_timer(&f->secret_timer, inet_frag_secret_rebuild,
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 10/41] mm/hotplug: prepare for removing num_physpages
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (8 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 09/41] mm: use totalram_pages instead of num_physpages at runtime Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 11/41] mm/alpha: prepare for removing num_physpages and simplify mem_init() Jiang Liu
` (30 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Tang Chen, Yasuaki Ishimatsu
Prepare for removing num_physpages.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
---
mm/memory_hotplug.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 304ada7..283755a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -760,10 +760,6 @@ EXPORT_SYMBOL_GPL(restore_online_page_callback);
void __online_page_set_limits(struct page *page)
{
- unsigned long pfn = page_to_pfn(page);
-
- if (pfn >= num_physpages)
- num_physpages = pfn + 1;
}
EXPORT_SYMBOL_GPL(__online_page_set_limits);
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 11/41] mm/alpha: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (9 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 10/41] mm/hotplug: prepare for removing num_physpages Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 12/41] mm/ARC: " Jiang Liu
` (29 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Richard Henderson, Ivan Kokshaysky, Matt Turner,
linux-alpha
Prepare for removing num_physpages and simplify mem_init().
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>
Cc: David Howells <dhowells@redhat.com>
Cc: linux-alpha@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/alpha/mm/init.c | 32 ++------------------------------
arch/alpha/mm/numa.c | 34 ++--------------------------------
2 files changed, 4 insertions(+), 62 deletions(-)
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index ca07a97..04c933c 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -277,42 +277,14 @@ srm_paging_stop (void)
#endif
#ifndef CONFIG_DISCONTIGMEM
-static void __init
-printk_memory_info(void)
-{
- unsigned long codesize, reservedpages, datasize, initsize, tmp;
- extern int page_is_ram(unsigned long) __init;
-
- /* printk all informations */
- reservedpages = 0;
- for (tmp = 0; tmp < max_low_pfn; tmp++)
- /*
- * Only count reserved RAM pages
- */
- if (page_is_ram(tmp) && PageReserved(mem_map+tmp))
- reservedpages++;
-
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_data;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, %luk data, %luk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- max_mapnr << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10);
-}
-
void __init
mem_init(void)
{
- max_mapnr = num_physpages = max_low_pfn;
+ max_mapnr = max_low_pfn;
free_all_bootmem();
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
- printk_memory_info();
+ mem_init_print_info(NULL);
}
#endif /* CONFIG_DISCONTIGMEM */
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index 857452c..0894b3a8 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -129,8 +129,6 @@ setup_memory_node(int nid, void *kernel_end)
if (node_max_pfn > max_low_pfn)
max_pfn = max_low_pfn = node_max_pfn;
- num_physpages += node_max_pfn - node_min_pfn;
-
#if 0 /* we'll try this one again in a little while */
/* Cute trick to make sure our local node data is on local memory */
node_data[nid] = (pg_data_t *)(__va(node_min_pfn << PAGE_SHIFT));
@@ -324,37 +322,9 @@ void __init paging_init(void)
void __init mem_init(void)
{
- unsigned long codesize, reservedpages, datasize, initsize, pfn;
- extern int page_is_ram(unsigned long) __init;
- unsigned long nid, i;
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
-
- reservedpages = 0;
- for_each_online_node(nid) {
- /*
- * This will free up the bootmem, ie, slot 0 memory
- */
- free_all_bootmem_node(NODE_DATA(nid));
-
- pfn = NODE_DATA(nid)->node_start_pfn;
- for (i = 0; i < node_spanned_pages(nid); i++, pfn++)
- if (page_is_ram(pfn) &&
- PageReserved(nid_page_nr(nid, i)))
- reservedpages++;
- }
-
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_data;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk("Memory: %luk/%luk available (%luk kernel code, %luk reserved, "
- "%luk data, %luk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10);
+ free_all_bootmem();
+ mem_init_print_info(NULL);
#if 0
mem_stress();
#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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 12/41] mm/ARC: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (10 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 11/41] mm/alpha: prepare for removing num_physpages and simplify mem_init() Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-29 8:41 ` Vineet Gupta
2013-05-08 15:51 ` [PATCH v5, part4 13/41] mm/ARM: " Jiang Liu
` (28 subsequent siblings)
40 siblings, 1 reply; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Vineet Gupta, James Hogan, Rob Herring
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: linux-kernel@vger.kernel.org
---
arch/arc/mm/init.c | 36 +++---------------------------------
1 file changed, 3 insertions(+), 33 deletions(-)
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 78d8c31..8ba6562 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -74,7 +74,7 @@ void __init setup_arch_memory(void)
/* Last usable page of low mem (no HIGHMEM yet for ARC port) */
max_low_pfn = max_pfn = PFN_DOWN(end_mem);
- max_mapnr = num_physpages = max_low_pfn - min_low_pfn;
+ max_mapnr = max_low_pfn - min_low_pfn;
/*------------- reserve kernel image -----------------------*/
memblock_reserve(CONFIG_LINUX_LINK_BASE,
@@ -84,7 +84,7 @@ void __init setup_arch_memory(void)
/*-------------- node setup --------------------------------*/
memset(zones_size, 0, sizeof(zones_size));
- zones_size[ZONE_NORMAL] = num_physpages;
+ zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
/*
* We can't use the helper free_area_init(zones[]) because it uses
@@ -106,39 +106,9 @@ void __init setup_arch_memory(void)
*/
void __init mem_init(void)
{
- int codesize, datasize, initsize, reserved_pages, free_pages;
- int tmp;
-
high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz);
-
free_all_bootmem();
-
- /* count all reserved pages [kernel code/data/mem_map..] */
- reserved_pages = 0;
- for (tmp = 0; tmp < max_mapnr; tmp++)
- if (PageReserved(mem_map + tmp))
- reserved_pages++;
-
- /* XXX: nr_free_pages() is equivalent */
- free_pages = max_mapnr - reserved_pages;
-
- /*
- * For the purpose of display below, split the "reserve mem"
- * kernel code/data is already shown explicitly,
- * Show any other reservations (mem_map[ ] et al)
- */
- reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >>
- PAGE_SHIFT);
-
- codesize = _etext - _text;
- datasize = _end - _etext;
- initsize = __init_end - __init_begin;
-
- pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n",
- PAGES_TO_MB(free_pages),
- TO_MB(arc_mem_sz),
- TO_KB(codesize), TO_KB(datasize), TO_KB(initsize),
- PAGES_TO_KB(reserved_pages));
+ mem_init_print_info(NULL);
}
/*
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 12/41] mm/ARC: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:51 ` [PATCH v5, part4 12/41] mm/ARC: " Jiang Liu
@ 2013-05-29 8:41 ` Vineet Gupta
2013-05-29 13:05 ` Liu Jiang
0 siblings, 1 reply; 53+ messages in thread
From: Vineet Gupta @ 2013-05-29 8:41 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, Sergei Shtylyov, David Howells, Mark Salter,
Jianguo Wu, linux-mm, linux-arch, linux-kernel, James Hogan,
Rob Herring
Hi Jiang,
On 05/08/2013 09:21 PM, Jiang Liu wrote:
> Prepare for removing num_physpages and simplify mem_init().
>
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Cc: linux-kernel@vger.kernel.org
> ---
> arch/arc/mm/init.c | 36 +++---------------------------------
> 1 file changed, 3 insertions(+), 33 deletions(-)
>
> diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
> index 78d8c31..8ba6562 100644
> --- a/arch/arc/mm/init.c
> +++ b/arch/arc/mm/init.c
> @@ -74,7 +74,7 @@ void __init setup_arch_memory(void)
> /* Last usable page of low mem (no HIGHMEM yet for ARC port) */
> max_low_pfn = max_pfn = PFN_DOWN(end_mem);
>
> - max_mapnr = num_physpages = max_low_pfn - min_low_pfn;
> + max_mapnr = max_low_pfn - min_low_pfn;
>
> /*------------- reserve kernel image -----------------------*/
> memblock_reserve(CONFIG_LINUX_LINK_BASE,
> @@ -84,7 +84,7 @@ void __init setup_arch_memory(void)
>
> /*-------------- node setup --------------------------------*/
> memset(zones_size, 0, sizeof(zones_size));
> - zones_size[ZONE_NORMAL] = num_physpages;
> + zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
>
> /*
> * We can't use the helper free_area_init(zones[]) because it uses
> @@ -106,39 +106,9 @@ void __init setup_arch_memory(void)
> */
> void __init mem_init(void)
> {
> - int codesize, datasize, initsize, reserved_pages, free_pages;
> - int tmp;
> -
> high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz);
> -
> free_all_bootmem();
> -
What baseline is this code against, since mainline looks like following:
high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz);
totalram_pages = free_all_bootmem();
So I would have expected the following
- totalram_pages = free_all_bootmem();
+ free_all_bootmem();
Aha, you missed out CCing all maintainers on "[PATCH v7, part3 14/16]" or rather
"[PATCH v8, part3 13/14]" - and it is difficult to dig this out from all the
patches that fly by on linux-arch.
Same goes for "[PATCH v8, part3 01/14]" and "[PATCH v8, part3 02/14]"
> - /* count all reserved pages [kernel code/data/mem_map..] */
> - reserved_pages = 0;
> - for (tmp = 0; tmp < max_mapnr; tmp++)
> - if (PageReserved(mem_map + tmp))
> - reserved_pages++;
> -
> - /* XXX: nr_free_pages() is equivalent */
> - free_pages = max_mapnr - reserved_pages;
> -
> - /*
> - * For the purpose of display below, split the "reserve mem"
> - * kernel code/data is already shown explicitly,
> - * Show any other reservations (mem_map[ ] et al)
> - */
> - reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >>
> - PAGE_SHIFT);
> -
> - codesize = _etext - _text;
> - datasize = _end - _etext;
> - initsize = __init_end - __init_begin;
> -
> - pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n",
> - PAGES_TO_MB(free_pages),
> - TO_MB(arc_mem_sz),
> - TO_KB(codesize), TO_KB(datasize), TO_KB(initsize),
> - PAGES_TO_KB(reserved_pages));
> + mem_init_print_info(NULL);
> }
>
> /*
>
The Changes look OK though. I managed to build your github tree (mem_init_v5
branch). And it seems to work ok.
Acked-by: Vineet Gupta <vgupta@synopsys.com> # for arch/arc
Thx
-Vineet
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 12/41] mm/ARC: prepare for removing num_physpages and simplify mem_init()
2013-05-29 8:41 ` Vineet Gupta
@ 2013-05-29 13:05 ` Liu Jiang
0 siblings, 0 replies; 53+ messages in thread
From: Liu Jiang @ 2013-05-29 13:05 UTC (permalink / raw)
To: Vineet Gupta
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, Sergei Shtylyov, David Howells, Mark Salter,
Jianguo Wu, linux-mm, linux-arch, linux-kernel, James Hogan,
Rob Herring
On Wed 29 May 2013 04:41:30 PM CST, Vineet Gupta wrote:
> Hi Jiang,
>
> On 05/08/2013 09:21 PM, Jiang Liu wrote:
>> Prepare for removing num_physpages and simplify mem_init().
>>
>> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
>> Cc: Vineet Gupta <vgupta@synopsys.com>
>> Cc: James Hogan <james.hogan@imgtec.com>
>> Cc: Rob Herring <rob.herring@calxeda.com>
>> Cc: linux-kernel@vger.kernel.org
>> ---
>> arch/arc/mm/init.c | 36 +++---------------------------------
>> 1 file changed, 3 insertions(+), 33 deletions(-)
>>
>> diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
>> index 78d8c31..8ba6562 100644
>> --- a/arch/arc/mm/init.c
>> +++ b/arch/arc/mm/init.c
>> @@ -74,7 +74,7 @@ void __init setup_arch_memory(void)
>> /* Last usable page of low mem (no HIGHMEM yet for ARC port) */
>> max_low_pfn = max_pfn = PFN_DOWN(end_mem);
>>
>> - max_mapnr = num_physpages = max_low_pfn - min_low_pfn;
>> + max_mapnr = max_low_pfn - min_low_pfn;
>>
>> /*------------- reserve kernel image -----------------------*/
>> memblock_reserve(CONFIG_LINUX_LINK_BASE,
>> @@ -84,7 +84,7 @@ void __init setup_arch_memory(void)
>>
>> /*-------------- node setup --------------------------------*/
>> memset(zones_size, 0, sizeof(zones_size));
>> - zones_size[ZONE_NORMAL] = num_physpages;
>> + zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
>>
>> /*
>> * We can't use the helper free_area_init(zones[]) because it uses
>> @@ -106,39 +106,9 @@ void __init setup_arch_memory(void)
>> */
>> void __init mem_init(void)
>> {
>> - int codesize, datasize, initsize, reserved_pages, free_pages;
>> - int tmp;
>> -
>> high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz);
>> -
>> free_all_bootmem();
>> -
>
> What baseline is this code against, since mainline looks like following:
>
> high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz);
>
> totalram_pages = free_all_bootmem();
>
> So I would handve expected the following
>
> - totalram_pages = free_all_bootmem();
> + free_all_bootmem();
>
> Aha, you missed out CCing all maintainers on "[PATCH v7, part3 14/16]" or rather
> "[PATCH v8, part3 13/14]" - and it is difficult to dig this out from all the
> patches that fly by on linux-arch.
>
> Same goes for "[PATCH v8, part3 01/14]" and "[PATCH v8, part3 02/14]"
Hi Vineet,
This patchset is based on Andrew's mmotm tree, there are some
differences
between mmotm and the upstream kernel, sorry for the inconvenience.
Once I sent those common patches to all related maintainers, but
the CC list
is too long and also caused other troubles. Next time I will send all
patches to
linux-arch maillist.
>
>> - /* count all reserved pages [kernel code/data/mem_map..] */
>> - reserved_pages = 0;
>> - for (tmp = 0; tmp < max_mapnr; tmp++)
>> - if (PageReserved(mem_map + tmp))
>> - reserved_pages++;
>> -
>> - /* XXX: nr_free_pages() is equivalent */
>> - free_pages = max_mapnr - reserved_pages;
>> -
>> - /*
>> - * For the purpose of display below, split the "reserve mem"
>> - * kernel code/data is already shown explicitly,
>> - * Show any other reservations (mem_map[ ] et al)
>> - */
>> - reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >>
>> - PAGE_SHIFT);
>> -
>> - codesize = _etext - _text;
>> - datasize = _end - _etext;
>> - initsize = __init_end - __init_begin;
>> -
>> - pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n",
>> - PAGES_TO_MB(free_pages),
>> - TO_MB(arc_mem_sz),
>> - TO_KB(codesize), TO_KB(datasize), TO_KB(initsize),
>> - PAGES_TO_KB(reserved_pages));
>> + mem_init_print_info(NULL);
>> }
>>
>> /*
>>
>
> The Changes look OK though. I managed to build your github tree (mem_init_v5
> branch). And it seems to work ok.
>
> Acked-by: Vineet Gupta <vgupta@synopsys.com> # for arch/arc
Thanks for review and tests!
Regards!
Gerry
>
> Thx
> -Vineet
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5, part4 13/41] mm/ARM: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (11 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 12/41] mm/ARC: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 14/41] mm/ARM64: " Jiang Liu
` (27 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Russell King, Catalin Marinas, Will Deacon,
linux-arm-kernel
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
arch/arm/mm/init.c | 47 ++---------------------------------------------
1 file changed, 2 insertions(+), 45 deletions(-)
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index add4fcb..7a911d1 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -582,9 +582,6 @@ static void __init free_highpages(void)
*/
void __init mem_init(void)
{
- unsigned long reserved_pages, free_pages;
- struct memblock_region *reg;
- int i;
#ifdef CONFIG_HAVE_TCM
/* These pointers are filled in on TCM detection */
extern u32 dtcm_end;
@@ -605,47 +602,7 @@ void __init mem_init(void)
free_highpages();
- reserved_pages = free_pages = 0;
-
- for_each_bank(i, &meminfo) {
- struct membank *bank = &meminfo.bank[i];
- unsigned int pfn1, pfn2;
- struct page *page, *end;
-
- pfn1 = bank_pfn_start(bank);
- pfn2 = bank_pfn_end(bank);
-
- page = pfn_to_page(pfn1);
- end = pfn_to_page(pfn2 - 1) + 1;
-
- do {
- if (PageReserved(page))
- reserved_pages++;
- else if (!page_count(page))
- free_pages++;
- page++;
- } while (page < end);
- }
-
- /*
- * Since our memory may not be contiguous, calculate the
- * real number of pages we have in this system
- */
- printk(KERN_INFO "Memory:");
- num_physpages = 0;
- for_each_memblock(memory, reg) {
- unsigned long pages = memblock_region_memory_end_pfn(reg) -
- memblock_region_memory_base_pfn(reg);
- num_physpages += pages;
- printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
- }
- printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
-
- printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- free_pages << (PAGE_SHIFT-10),
- reserved_pages << (PAGE_SHIFT-10),
- totalhigh_pages << (PAGE_SHIFT-10));
+ mem_init_print_info(NULL);
#define MLK(b, t) b, t, ((t) - (b)) >> 10
#define MLM(b, t) b, t, ((t) - (b)) >> 20
@@ -711,7 +668,7 @@ void __init mem_init(void)
BUG_ON(PKMAP_BASE + LAST_PKMAP * PAGE_SIZE > PAGE_OFFSET);
#endif
- if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
+ if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
extern int sysctl_overcommit_memory;
/*
* On a machine this small we won't get
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 14/41] mm/ARM64: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (12 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 13/41] mm/ARM: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 15/41] mm/AVR32: " Jiang Liu
` (26 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Russell King, Catalin Marinas, Will Deacon,
linux-arm-kernel
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
arch/arm64/mm/init.c | 48 +++---------------------------------------------
1 file changed, 3 insertions(+), 45 deletions(-)
diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
index 0f2cf5d..821e788 100644
--- a/arch/arm64/mm/init.c
+++ b/arch/arm64/mm/init.c
@@ -272,59 +272,17 @@ static void __init free_unused_memmap(void)
*/
void __init mem_init(void)
{
- unsigned long reserved_pages, free_pages;
- struct memblock_region *reg;
-
arm64_swiotlb_init();
max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
#ifndef CONFIG_SPARSEMEM_VMEMMAP
- /* this will put all unused low memory onto the freelists */
free_unused_memmap();
#endif
-
+ /* this will put all unused low memory onto the freelists */
free_all_bootmem();
- reserved_pages = free_pages = 0;
-
- for_each_memblock(memory, reg) {
- unsigned int pfn1, pfn2;
- struct page *page, *end;
-
- pfn1 = __phys_to_pfn(reg->base);
- pfn2 = pfn1 + __phys_to_pfn(reg->size);
-
- page = pfn_to_page(pfn1);
- end = pfn_to_page(pfn2 - 1) + 1;
-
- do {
- if (PageReserved(page))
- reserved_pages++;
- else if (!page_count(page))
- free_pages++;
- page++;
- } while (page < end);
- }
-
- /*
- * Since our memory may not be contiguous, calculate the real number
- * of pages we have in this system.
- */
- pr_info("Memory:");
- num_physpages = 0;
- for_each_memblock(memory, reg) {
- unsigned long pages = memblock_region_memory_end_pfn(reg) -
- memblock_region_memory_base_pfn(reg);
- num_physpages += pages;
- printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
- }
- printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
-
- pr_notice("Memory: %luk/%luk available, %luk reserved\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- free_pages << (PAGE_SHIFT-10),
- reserved_pages << (PAGE_SHIFT-10));
+ mem_init_print_info();
#define MLK(b, t) b, t, ((t) - (b)) >> 10
#define MLM(b, t) b, t, ((t) - (b)) >> 20
@@ -366,7 +324,7 @@ void __init mem_init(void)
BUILD_BUG_ON(TASK_SIZE_64 > MODULES_VADDR);
BUG_ON(TASK_SIZE_64 > MODULES_VADDR);
- if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
+ if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
extern int sysctl_overcommit_memory;
/*
* On a machine this small we won't get anywhere without
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 15/41] mm/AVR32: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (13 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 14/41] mm/ARM64: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 16/41] mm/blackfin: " Jiang Liu
` (25 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Haavard Skinnemoen
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: linux-kernel@vger.kernel.org
---
arch/avr32/mm/init.c | 29 ++++-------------------------
1 file changed, 4 insertions(+), 25 deletions(-)
diff --git a/arch/avr32/mm/init.c b/arch/avr32/mm/init.c
index 7e8d55a..c1706a0 100644
--- a/arch/avr32/mm/init.c
+++ b/arch/avr32/mm/init.c
@@ -100,26 +100,16 @@ void __init paging_init(void)
void __init mem_init(void)
{
- int codesize, reservedpages, datasize, initsize;
- int nid, i;
+ pg_data_t *pgdat;
- reservedpages = 0;
high_memory = NULL;
/* this will put all low memory onto the freelists */
- for_each_online_node(nid) {
- pg_data_t *pgdat = NODE_DATA(nid);
- unsigned long node_pages = 0;
+ for_each_online_pgdat(pgdat) {
void *node_high_memory;
- num_physpages += pgdat->node_present_pages;
-
if (pgdat->node_spanned_pages != 0)
- node_pages = free_all_bootmem_node(pgdat);
-
- for (i = 0; i < node_pages; i++)
- if (PageReserved(pgdat->node_mem_map + i))
- reservedpages++;
+ free_all_bootmem_node(pgdat);
node_high_memory = (void *)((pgdat->node_start_pfn
+ pgdat->node_spanned_pages)
@@ -130,18 +120,7 @@ void __init mem_init(void)
max_mapnr = MAP_NR(high_memory);
- codesize = (unsigned long)_etext - (unsigned long)_text;
- datasize = (unsigned long)_edata - (unsigned long)_data;
- initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
-
- printk ("Memory: %luk/%luk available (%dk kernel code, "
- "%dk reserved, %dk data, %dk init)\n",
- nr_free_pages() << (PAGE_SHIFT - 10),
- totalram_pages << (PAGE_SHIFT - 10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT - 10),
- datasize >> 10,
- initsize >> 10);
+ mem_init_print_info(NULL);
}
void free_initmem(void)
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 16/41] mm/blackfin: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (14 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 15/41] mm/AVR32: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-25 13:25 ` Sonic Zhang
2013-05-08 15:51 ` [PATCH v5, part4 17/41] mm/c6x: " Jiang Liu
` (24 subsequent siblings)
40 siblings, 1 reply; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Mike Frysinger, Bob Liu, uclinux-dist-devel
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Bob Liu <lliubbo@gmail.com>
Cc: uclinux-dist-devel@blackfin.uclinux.org
Cc: linux-kernel@vger.kernel.org
---
arch/blackfin/mm/init.c | 38 ++++++--------------------------------
1 file changed, 6 insertions(+), 32 deletions(-)
diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
index 1cc8607..e4b6e11 100644
--- a/arch/blackfin/mm/init.c
+++ b/arch/blackfin/mm/init.c
@@ -90,43 +90,17 @@ asmlinkage void __init init_pda(void)
void __init mem_init(void)
{
- unsigned int codek = 0, datak = 0, initk = 0;
- unsigned int reservedpages = 0, freepages = 0;
- unsigned long tmp;
- unsigned long start_mem = memory_start;
- unsigned long end_mem = memory_end;
+ char buf[64];
- end_mem &= PAGE_MASK;
- high_memory = (void *)end_mem;
-
- start_mem = PAGE_ALIGN(start_mem);
- max_mapnr = num_physpages = MAP_NR(high_memory);
- printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages);
+ high_memory = (void *)(memory_end & PAGE_MASK);
+ max_mapnr = MAP_NR(high_memory);
+ printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", max_mapnr);
/* This will put all low memory onto the freelists. */
free_all_bootmem();
- reservedpages = 0;
- for (tmp = ARCH_PFN_OFFSET; tmp < max_mapnr; tmp++)
- if (PageReserved(pfn_to_page(tmp)))
- reservedpages++;
- freepages = max_mapnr - ARCH_PFN_OFFSET - reservedpages;
-
- /* do not count in kernel image between _rambase and _ramstart */
- reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT;
-#if (defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) && ANOMALY_05000263)
- reservedpages += (_ramend - memory_end - DMA_UNCACHED_REGION) >> PAGE_SHIFT;
-#endif
-
- codek = (_etext - _stext) >> 10;
- initk = (__init_end - __init_begin) >> 10;
- datak = ((_ramstart - _rambase) >> 10) - codek - initk;
-
- printk(KERN_INFO
- "Memory available: %luk/%luk RAM, "
- "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n",
- (unsigned long) freepages << (PAGE_SHIFT-10), (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 10,
- initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
+ snprintf(buf, sizeof(buf) - 1, "%uK DMA", DMA_UNCACHED_REGION >> 10);
+ mem_init_print_info(buf);
}
#ifdef CONFIG_BLK_DEV_INITRD
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 16/41] mm/blackfin: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:51 ` [PATCH v5, part4 16/41] mm/blackfin: " Jiang Liu
@ 2013-05-25 13:25 ` Sonic Zhang
2013-05-26 13:55 ` Liu Jiang
0 siblings, 1 reply; 53+ messages in thread
From: Sonic Zhang @ 2013-05-25 13:25 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, Sergei Shtylyov, David Howells, Mark Salter,
Jianguo Wu, linux-mm, linux-arch, Linux Kernel, Mike Frysinger,
Bob Liu, uclinux-dist-devel
Hi Jiang
On Wed, May 8, 2013 at 11:51 PM, Jiang Liu <liuj97@gmail.com> wrote:
> Prepare for removing num_physpages and simplify mem_init().
>
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: Mike Frysinger <vapier@gentoo.org>
> Cc: Bob Liu <lliubbo@gmail.com>
> Cc: uclinux-dist-devel@blackfin.uclinux.org
> Cc: linux-kernel@vger.kernel.org
> ---
> arch/blackfin/mm/init.c | 38 ++++++--------------------------------
> 1 file changed, 6 insertions(+), 32 deletions(-)
>
> diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
> index 1cc8607..e4b6e11 100644
> --- a/arch/blackfin/mm/init.c
> +++ b/arch/blackfin/mm/init.c
> @@ -90,43 +90,17 @@ asmlinkage void __init init_pda(void)
>
> void __init mem_init(void)
> {
> - unsigned int codek = 0, datak = 0, initk = 0;
> - unsigned int reservedpages = 0, freepages = 0;
> - unsigned long tmp;
> - unsigned long start_mem = memory_start;
> - unsigned long end_mem = memory_end;
> + char buf[64];
>
> - end_mem &= PAGE_MASK;
> - high_memory = (void *)end_mem;
> -
> - start_mem = PAGE_ALIGN(start_mem);
> - max_mapnr = num_physpages = MAP_NR(high_memory);
> - printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages);
> + high_memory = (void *)(memory_end & PAGE_MASK);
> + max_mapnr = MAP_NR(high_memory);
> + printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", max_mapnr);
>
> /* This will put all low memory onto the freelists. */
> free_all_bootmem();
>
> - reservedpages = 0;
> - for (tmp = ARCH_PFN_OFFSET; tmp < max_mapnr; tmp++)
> - if (PageReserved(pfn_to_page(tmp)))
> - reservedpages++;
> - freepages = max_mapnr - ARCH_PFN_OFFSET - reservedpages;
> -
> - /* do not count in kernel image between _rambase and _ramstart */
> - reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT;
> -#if (defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) && ANOMALY_05000263)
> - reservedpages += (_ramend - memory_end - DMA_UNCACHED_REGION) >> PAGE_SHIFT;
> -#endif
> -
> - codek = (_etext - _stext) >> 10;
> - initk = (__init_end - __init_begin) >> 10;
> - datak = ((_ramstart - _rambase) >> 10) - codek - initk;
> -
> - printk(KERN_INFO
> - "Memory available: %luk/%luk RAM, "
> - "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n",
> - (unsigned long) freepages << (PAGE_SHIFT-10), (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 10,
> - initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
You can't remove all these memory information for blackfin. They are
useful on blackfin platform.
Regards,
Sonic
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 16/41] mm/blackfin: prepare for removing num_physpages and simplify mem_init()
2013-05-25 13:25 ` Sonic Zhang
@ 2013-05-26 13:55 ` Liu Jiang
0 siblings, 0 replies; 53+ messages in thread
From: Liu Jiang @ 2013-05-26 13:55 UTC (permalink / raw)
To: Sonic Zhang
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, Sergei Shtylyov, David Howells, Mark Salter,
Jianguo Wu, linux-mm, linux-arch, Linux Kernel, Mike Frysinger,
Bob Liu, uclinux-dist-devel
On Sat 25 May 2013 09:25:47 PM CST, Sonic Zhang wrote:
> Hi Jiang
>
> On Wed, May 8, 2013 at 11:51 PM, Jiang Liu <liuj97@gmail.com> wrote:
>> Prepare for removing num_physpages and simplify mem_init().
>>
>> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
>> Cc: Mike Frysinger <vapier@gentoo.org>
>> Cc: Bob Liu <lliubbo@gmail.com>
>> Cc: uclinux-dist-devel@blackfin.uclinux.org
>> Cc: linux-kernel@vger.kernel.org
>> ---
>> arch/blackfin/mm/init.c | 38 ++++++--------------------------------
>> 1 file changed, 6 insertions(+), 32 deletions(-)
>>
>> diff --git a/arch/blackfin/mm/init.c b/arch/blackfin/mm/init.c
>> index 1cc8607..e4b6e11 100644
>> --- a/arch/blackfin/mm/init.c
>> +++ b/arch/blackfin/mm/init.c
>> @@ -90,43 +90,17 @@ asmlinkage void __init init_pda(void)
>>
>> void __init mem_init(void)
>> {
>> - unsigned int codek = 0, datak = 0, initk = 0;
>> - unsigned int reservedpages = 0, freepages = 0;
>> - unsigned long tmp;
>> - unsigned long start_mem = memory_start;
>> - unsigned long end_mem = memory_end;
>> + char buf[64];
>>
>> - end_mem &= PAGE_MASK;
>> - high_memory = (void *)end_mem;
>> -
>> - start_mem = PAGE_ALIGN(start_mem);
>> - max_mapnr = num_physpages = MAP_NR(high_memory);
>> - printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", num_physpages);
>> + high_memory = (void *)(memory_end & PAGE_MASK);
>> + max_mapnr = MAP_NR(high_memory);
>> + printk(KERN_DEBUG "Kernel managed physical pages: %lu\n", max_mapnr);
>>
>> /* This will put all low memory onto the freelists. */
>> free_all_bootmem();
>>
>> - reservedpages = 0;
>> - for (tmp = ARCH_PFN_OFFSET; tmp < max_mapnr; tmp++)
>> - if (PageReserved(pfn_to_page(tmp)))
>> - reservedpages++;
>> - freepages = max_mapnr - ARCH_PFN_OFFSET - reservedpages;
>> -
>> - /* do not count in kernel image between _rambase and _ramstart */
>> - reservedpages -= (_ramstart - _rambase) >> PAGE_SHIFT;
>> -#if (defined(CONFIG_BFIN_EXTMEM_ICACHEABLE) && ANOMALY_05000263)
>> - reservedpages += (_ramend - memory_end - DMA_UNCACHED_REGION) >> PAGE_SHIFT;
>> -#endif
>> -
>> - codek = (_etext - _stext) >> 10;
>> - initk = (__init_end - __init_begin) >> 10;
>> - datak = ((_ramstart - _rambase) >> 10) - codek - initk;
>> -
>> - printk(KERN_INFO
>> - "Memory available: %luk/%luk RAM, "
>> - "(%uk init code, %uk kernel code, %uk data, %uk dma, %uk reserved)\n",
>> - (unsigned long) freepages << (PAGE_SHIFT-10), (_ramend - CONFIG_PHY_RAM_BASE_ADDRESS) >> 10,
>> - initk, codek, datak, DMA_UNCACHED_REGION >> 10, (reservedpages << (PAGE_SHIFT-10)));
>
> You can't remove all these memory information for blackfin. They are
> useful on blackfin platform.
>
> Regards,
>
> Sonic
Hi Sonic,
Thanks for review!
We are not trying to remove these code, but replacing it
with a generic
helper function mem_init_print_info(), which will print similar (actual
more info)
boot message. I have no blackfin platforms to generate a real boot
message,
so could only share an example boot messages on x86:
Memory: 7744624K/8074824K available (6969K kernel code, 1011K data,
2828K rodata, 1016K init, 9640K bss, 330200K reserved)
Regards!
Gerry
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5, part4 17/41] mm/c6x: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (15 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 16/41] mm/blackfin: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 18/41] mm/cris: " Jiang Liu
` (23 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Aurelien Jacquiot, linux-c6x-dev
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-kernel@vger.kernel.org
---
arch/c6x/mm/init.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/arch/c6x/mm/init.c b/arch/c6x/mm/init.c
index 2c51474..066f75c 100644
--- a/arch/c6x/mm/init.c
+++ b/arch/c6x/mm/init.c
@@ -57,21 +57,12 @@ void __init paging_init(void)
void __init mem_init(void)
{
- int codek, datak;
- unsigned long tmp;
- unsigned long len = memory_end - memory_start;
-
high_memory = (void *)(memory_end & PAGE_MASK);
/* this will put all memory onto the freelists */
free_all_bootmem();
- codek = (_etext - _stext) >> 10;
- datak = (_end - _sdata) >> 10;
-
- tmp = nr_free_pages() << PAGE_SHIFT;
- printk(KERN_INFO "Memory: %luk/%luk RAM (%dk kernel code, %dk data)\n",
- tmp >> 10, len >> 10, codek, datak);
+ mem_init_print_info(NULL);
}
#ifdef CONFIG_BLK_DEV_INITRD
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 18/41] mm/cris: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (16 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 17/41] mm/c6x: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 19/41] mm/frv: " Jiang Liu
` (22 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Mikael Starvik, linux-cris-kernel
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: linux-cris-kernel@axis.com
Cc: linux-kernel@vger.kernel.org
---
arch/cris/mm/init.c | 33 ++-------------------------------
1 file changed, 2 insertions(+), 31 deletions(-)
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index 52b8b56..c81af5b 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -19,9 +19,6 @@ unsigned long empty_zero_page;
void __init
mem_init(void)
{
- int codesize, reservedpages, datasize, initsize;
- unsigned long tmp;
-
BUG_ON(!mem_map);
/* max/min_low_pfn was set by setup.c
@@ -29,35 +26,9 @@ mem_init(void)
*
* high_memory was also set in setup.c
*/
-
- max_mapnr = num_physpages = max_low_pfn - min_low_pfn;
-
- /* this will put all memory onto the freelists */
+ max_mapnr = max_low_pfn - min_low_pfn;
free_all_bootmem();
-
- reservedpages = 0;
- for (tmp = 0; tmp < max_mapnr; tmp++) {
- /*
- * Only count reserved RAM pages
- */
- if (PageReserved(mem_map + tmp))
- reservedpages++;
- }
-
- codesize = (unsigned long) &_etext - (unsigned long) &_stext;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk(KERN_INFO
- "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, "
- "%dk init)\n" ,
- nr_free_pages() << (PAGE_SHIFT-10),
- max_mapnr << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10
- );
+ mem_init_print_info(NULL);
}
/* free the pages occupied by initialization code */
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 19/41] mm/frv: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (17 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 18/41] mm/cris: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 20/41] mm/h8300: " Jiang Liu
` (21 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Andi Kleen, Geert Uytterhoeven, Greg Kroah-Hartman
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org
---
arch/frv/kernel/setup.c | 13 +++++++------
arch/frv/mm/init.c | 49 ++++++++++++++---------------------------------
2 files changed, 21 insertions(+), 41 deletions(-)
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index a513647..f78f8cb 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -876,6 +876,7 @@ late_initcall(setup_arch_serial);
static void __init setup_linux_memory(void)
{
unsigned long bootmap_size, low_top_pfn, kstart, kend, high_mem;
+ unsigned long physpages;
kstart = (unsigned long) &__kernel_image_start - PAGE_OFFSET;
kend = (unsigned long) &__kernel_image_end - PAGE_OFFSET;
@@ -893,19 +894,19 @@ static void __init setup_linux_memory(void)
);
/* pass the memory that the kernel can immediately use over to the bootmem allocator */
- max_mapnr = num_physpages = (memory_end - memory_start) >> PAGE_SHIFT;
+ max_mapnr = physpages = (memory_end - memory_start) >> PAGE_SHIFT;
low_top_pfn = (KERNEL_LOWMEM_END - KERNEL_LOWMEM_START) >> PAGE_SHIFT;
high_mem = 0;
- if (num_physpages > low_top_pfn) {
+ if (physpages > low_top_pfn) {
#ifdef CONFIG_HIGHMEM
- high_mem = num_physpages - low_top_pfn;
+ high_mem = physpages - low_top_pfn;
#else
- max_mapnr = num_physpages = low_top_pfn;
+ max_mapnr = physpages = low_top_pfn;
#endif
}
else {
- low_top_pfn = num_physpages;
+ low_top_pfn = physpages;
}
min_low_pfn = memory_start >> PAGE_SHIFT;
@@ -979,7 +980,7 @@ static void __init setup_uclinux_memory(void)
free_bootmem(memory_start, memory_end - memory_start);
high_memory = (void *) (memory_end & PAGE_MASK);
- max_mapnr = num_physpages = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
+ max_mapnr = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
min_low_pfn = memory_start >> PAGE_SHIFT;
max_low_pfn = memory_end >> PAGE_SHIFT;
diff --git a/arch/frv/mm/init.c b/arch/frv/mm/init.c
index 4215822..e9e2b6f 100644
--- a/arch/frv/mm/init.c
+++ b/arch/frv/mm/init.c
@@ -78,7 +78,7 @@ void __init paging_init(void)
memset((void *) empty_zero_page, 0, PAGE_SIZE);
#ifdef CONFIG_HIGHMEM
- if (num_physpages - num_mappedpages) {
+ if (get_num_physpages() - num_mappedpages) {
pgd_t *pge;
pud_t *pue;
pmd_t *pme;
@@ -96,7 +96,7 @@ void __init paging_init(void)
*/
zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
#ifdef CONFIG_HIGHMEM
- zones_size[ZONE_HIGHMEM] = num_physpages - num_mappedpages;
+ zones_size[ZONE_HIGHMEM] = get_num_physpages() - num_mappedpages;
#endif
free_area_init(zones_size);
@@ -114,45 +114,24 @@ void __init paging_init(void)
*/
void __init mem_init(void)
{
- unsigned long npages = (memory_end - memory_start) >> PAGE_SHIFT;
- unsigned long tmp;
-#ifdef CONFIG_MMU
- unsigned long loop, pfn;
- int datapages = 0;
-#endif
- int codek = 0, datak = 0;
+ unsigned long code_size = _etext - _stext;
/* this will put all low memory onto the freelists */
free_all_bootmem();
+#if defined(CONFIG_MMU) && defined(CONFIG_HIGHMEM)
+ {
+ unsigned long pfn;
-#ifdef CONFIG_MMU
- for (loop = 0 ; loop < npages ; loop++)
- if (PageReserved(&mem_map[loop]))
- datapages++;
-
-#ifdef CONFIG_HIGHMEM
- for (pfn = num_physpages - 1; pfn >= num_mappedpages; pfn--)
- free_highmem_page(&mem_map[pfn]);
-#endif
-
- codek = ((unsigned long) &_etext - (unsigned long) &_stext) >> 10;
- datak = datapages << (PAGE_SHIFT - 10);
-
-#else
- codek = (_etext - _stext) >> 10;
- datak = 0; //(__bss_stop - _sdata) >> 10;
+ for (pfn = get_num_physpages() - 1;
+ pfn >= num_mappedpages; pfn--)
+ free_highmem_page(&mem_map[pfn]);
+ }
#endif
- tmp = nr_free_pages() << PAGE_SHIFT;
- printk("Memory available: %luKiB/%luKiB RAM, %luKiB/%luKiB ROM (%dKiB kernel code, %dKiB data)\n",
- tmp >> 10,
- npages << (PAGE_SHIFT - 10),
- (rom_length > 0) ? ((rom_length >> 10) - codek) : 0,
- rom_length >> 10,
- codek,
- datak
- );
-
+ mem_init_print_info(NULL);
+ if (rom_length > 0 && rom_length >= code_size)
+ printk("Memory available: %luKiB/%luKiB ROM\n",
+ (rom_length - code_size) >> 10, rom_length >> 10);
} /* end mem_init() */
/*****************************************************************************/
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 20/41] mm/h8300: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (18 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 19/41] mm/frv: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 16:26 ` Sergei Shtylyov
2013-05-08 15:51 ` [PATCH v5, part4 21/41] mm/hexagon: " Jiang Liu
` (20 subsequent siblings)
40 siblings, 1 reply; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Yoshinori Sato, Geert Uytterhoeven
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-kernel@vger.kernel.org
---
arch/h8300/mm/init.c | 34 ++++++++--------------------------
1 file changed, 8 insertions(+), 26 deletions(-)
diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
index 22fd869..0088f3a 100644
--- a/arch/h8300/mm/init.c
+++ b/arch/h8300/mm/init.c
@@ -121,40 +121,22 @@ void __init paging_init(void)
void __init mem_init(void)
{
- int codek = 0, datak = 0, initk = 0;
- /* DAVIDM look at setup memory map generically with reserved area */
- unsigned long tmp;
- extern unsigned long _ramend, _ramstart;
- unsigned long len = &_ramend - &_ramstart;
- unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */
- unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */
+ unsigned long codesize = _etext - _stext;
#ifdef DEBUG
- printk(KERN_DEBUG "Mem_init: start=%lx, end=%lx\n", start_mem, end_mem);
+ pr_debug("Mem_init: start=%lx, end=%lx\n", memory_start, memory_end);
#endif
- end_mem &= PAGE_MASK;
- high_memory = (void *) end_mem;
-
- start_mem = PAGE_ALIGN(start_mem);
- max_mapnr = num_physpages = MAP_NR(high_memory);
+ high_memory = (void *) (memory_end & PAGE_MASK);
+ max_mapnr = MAP_NR(high_memory);
/* this will put all low memory onto the freelists */
free_all_bootmem();
- codek = (_etext - _stext) >> 10;
- datak = (__bss_stop - _sdata) >> 10;
- initk = (__init_begin - __init_end) >> 10;
-
- tmp = nr_free_pages() << PAGE_SHIFT;
- printk(KERN_INFO "Memory available: %luk/%luk RAM, %luk/%luk ROM (%dk kernel code, %dk data)\n",
- tmp >> 10,
- len >> 10,
- (rom_length > 0) ? ((rom_length >> 10) - codek) : 0,
- rom_length >> 10,
- codek,
- datak
- );
+ mem_init_print_info(NULL);
+ if (rom_length > 0 && rom_length > codesize)
+ pr_info("Memory available: %luK/%luK ROM\n",
+ (rom_length - codesize) >> 10, rom_length >> 10);
}
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 20/41] mm/h8300: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:51 ` [PATCH v5, part4 20/41] mm/h8300: " Jiang Liu
@ 2013-05-08 16:26 ` Sergei Shtylyov
2013-05-08 19:29 ` Sergei Shtylyov
0 siblings, 1 reply; 53+ messages in thread
From: Sergei Shtylyov @ 2013-05-08 16:26 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, David Howells, Mark Salter, Jianguo Wu, linux-mm,
linux-arch, linux-kernel, Yoshinori Sato, Geert Uytterhoeven
Hello.
On 08-05-2013 19:51, Jiang Liu wrote:
> Prepare for removing num_physpages and simplify mem_init().
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: linux-kernel@vger.kernel.org
> ---
> arch/h8300/mm/init.c | 34 ++++++++--------------------------
> 1 file changed, 8 insertions(+), 26 deletions(-)
> diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
> index 22fd869..0088f3a 100644
> --- a/arch/h8300/mm/init.c
> +++ b/arch/h8300/mm/init.c
> @@ -121,40 +121,22 @@ void __init paging_init(void)
>
> void __init mem_init(void)
> {
> - int codek = 0, datak = 0, initk = 0;
> - /* DAVIDM look at setup memory map generically with reserved area */
> - unsigned long tmp;
> - extern unsigned long _ramend, _ramstart;
> - unsigned long len = &_ramend - &_ramstart;
> - unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */
> - unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */
> + unsigned long codesize = _etext - _stext;
>
> #ifdef DEBUG
> - printk(KERN_DEBUG "Mem_init: start=%lx, end=%lx\n", start_mem, end_mem);
> + pr_debug("Mem_init: start=%lx, end=%lx\n", memory_start, memory_end);
> #endif
pr_debug() only prints something if DEBUG is #define'd, so you can
drop the #ifdef here.
WBR, Sergei
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 20/41] mm/h8300: prepare for removing num_physpages and simplify mem_init()
2013-05-08 16:26 ` Sergei Shtylyov
@ 2013-05-08 19:29 ` Sergei Shtylyov
2013-05-08 23:35 ` Cody P Schafer
0 siblings, 1 reply; 53+ messages in thread
From: Sergei Shtylyov @ 2013-05-08 19:29 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, David Howells, Mark Salter, Jianguo Wu, linux-mm,
linux-arch, linux-kernel, Yoshinori Sato, Geert Uytterhoeven
Hello.
On 05/08/2013 08:26 PM, Sergei Shtylyov wrote:
>
>> Prepare for removing num_physpages and simplify mem_init().
>
>> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
>> Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
>> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
>> Cc: linux-kernel@vger.kernel.org
>> ---
>> arch/h8300/mm/init.c | 34 ++++++++--------------------------
>> 1 file changed, 8 insertions(+), 26 deletions(-)
>
>> diff --git a/arch/h8300/mm/init.c b/arch/h8300/mm/init.c
>> index 22fd869..0088f3a 100644
>> --- a/arch/h8300/mm/init.c
>> +++ b/arch/h8300/mm/init.c
>> @@ -121,40 +121,22 @@ void __init paging_init(void)
>>
>> void __init mem_init(void)
>> {
>> - int codek = 0, datak = 0, initk = 0;
>> - /* DAVIDM look at setup memory map generically with reserved
>> area */
>> - unsigned long tmp;
>> - extern unsigned long _ramend, _ramstart;
>> - unsigned long len = &_ramend - &_ramstart;
>> - unsigned long start_mem = memory_start; /* DAVIDM - these must
>> start at end of kernel */
>> - unsigned long end_mem = memory_end; /* DAVIDM - this must not
>> include kernel stack at top */
>> + unsigned long codesize = _etext - _stext;
>>
>> #ifdef DEBUG
>> - printk(KERN_DEBUG "Mem_init: start=%lx, end=%lx\n", start_mem,
>> end_mem);
>> + pr_debug("Mem_init: start=%lx, end=%lx\n", memory_start,
>> memory_end);
>> #endif
>
> pr_debug() only prints something if DEBUG is #define'd, so you can
> drop the #ifdef here.
Although, not necessarily: it also supports CONFIG_DYNAMIC_DEBUG --
look at how pr_debug() is defined.
So this doesn't seem to be an equivalent change, and I suggest not doing
it at all.
WBR, Sergei
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 20/41] mm/h8300: prepare for removing num_physpages and simplify mem_init()
2013-05-08 19:29 ` Sergei Shtylyov
@ 2013-05-08 23:35 ` Cody P Schafer
2013-05-12 15:17 ` Liu Jiang
0 siblings, 1 reply; 53+ messages in thread
From: Cody P Schafer @ 2013-05-08 23:35 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Jiang Liu, Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, David Howells, Mark Salter, Jianguo Wu, linux-mm,
linux-arch, linux-kernel, Yoshinori Sato, Geert Uytterhoeven
On 05/08/2013 12:29 PM, Sergei Shtylyov wrote:
>
> Although, not necessarily: it also supports CONFIG_DYNAMIC_DEBUG --
> look at how pr_debug() is defined.
> So this doesn't seem to be an equivalent change, and I suggest not doing
> it at all.
>
> WBR, Sergei
pr_devel() should get the same behavior: no code emitted unless debug is
defined, if it is, output at KERN_DEBUG level.
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 20/41] mm/h8300: prepare for removing num_physpages and simplify mem_init()
2013-05-08 23:35 ` Cody P Schafer
@ 2013-05-12 15:17 ` Liu Jiang
0 siblings, 0 replies; 53+ messages in thread
From: Liu Jiang @ 2013-05-12 15:17 UTC (permalink / raw)
To: Cody P Schafer
Cc: Sergei Shtylyov, Andrew Morton, Jiang Liu, David Rientjes,
Wen Congyang, Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki,
Michal Hocko, James Bottomley, David Howells, Mark Salter,
Jianguo Wu, linux-mm, linux-arch, linux-kernel, Yoshinori Sato,
Geert Uytterhoeven
On 05/09/2013 07:35 AM, Cody P Schafer wrote:
> On 05/08/2013 12:29 PM, Sergei Shtylyov wrote:
>>
>> Although, not necessarily: it also supports CONFIG_DYNAMIC_DEBUG --
>> look at how pr_debug() is defined.
>> So this doesn't seem to be an equivalent change, and I suggest not doing
>> it at all.
>>
>> WBR, Sergei
>
> pr_devel() should get the same behavior: no code emitted unless debug
> is defined, if it is, output at KERN_DEBUG level.
>
Thanks Cody and Sergei, will use pr_devel() instead in next version.
Gerry
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5, part4 21/41] mm/hexagon: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (19 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 20/41] mm/h8300: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 22/41] mm/IA64: " Jiang Liu
` (19 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Richard Kuo, linux-hexagon
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: linux-hexagon@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/hexagon/mm/init.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c
index 0ab5b43..88977e4 100644
--- a/arch/hexagon/mm/init.c
+++ b/arch/hexagon/mm/init.c
@@ -71,9 +71,7 @@ void __init mem_init(void)
{
/* No idea where this is actually declared. Seems to evade LXR. */
free_all_bootmem();
- num_physpages = bootmem_lastpg-ARCH_PFN_OFFSET;
-
- printk(KERN_INFO "totalram_pages = %ld\n", totalram_pages);
+ mem_init_print_info(NULL);
/*
* To-Do: someone somewhere should wipe out the bootmem map
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 22/41] mm/IA64: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (20 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 21/41] mm/hexagon: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 23/41] mm/m32r: " Jiang Liu
` (18 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Tony Luck, Fenghua Yu, Zhang Yanfei, linux-ia64
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
Cc: linux-ia64@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/ia64/mm/contig.c | 11 -----------
arch/ia64/mm/discontig.c | 3 ---
arch/ia64/mm/init.c | 27 +--------------------------
3 files changed, 1 insertion(+), 40 deletions(-)
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 955fd25..b975c8b 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -295,14 +295,6 @@ find_memory (void)
alloc_per_cpu_data();
}
-static int count_pages(u64 start, u64 end, void *arg)
-{
- unsigned long *count = arg;
-
- *count += (end - start) >> PAGE_SHIFT;
- return 0;
-}
-
/*
* Set up the page tables.
*/
@@ -313,9 +305,6 @@ paging_init (void)
unsigned long max_dma;
unsigned long max_zone_pfns[MAX_NR_ZONES];
- num_physpages = 0;
- efi_memmap_walk(count_pages, &num_physpages);
-
memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
#ifdef CONFIG_ZONE_DMA
max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 254ae8e..3aef17c 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -37,7 +37,6 @@ struct early_node_data {
struct ia64_node_data *node_data;
unsigned long pernode_addr;
unsigned long pernode_size;
- unsigned long num_physpages;
#ifdef CONFIG_ZONE_DMA
unsigned long num_dma_physpages;
#endif
@@ -732,7 +731,6 @@ static __init int count_node_pages(unsigned long start, unsigned long len, int n
{
unsigned long end = start + len;
- mem_data[node].num_physpages += len >> PAGE_SHIFT;
#ifdef CONFIG_ZONE_DMA
if (start <= __pa(MAX_DMA_ADDRESS))
mem_data[node].num_dma_physpages +=
@@ -778,7 +776,6 @@ void __init paging_init(void)
#endif
for_each_online_node(node) {
- num_physpages += mem_data[node].num_physpages;
pfn_offset = mem_data[node].min_pfn;
#ifdef CONFIG_VIRTUAL_MEM_MAP
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index b5b71e8..d4382dc 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -546,19 +546,6 @@ int __init register_active_ranges(u64 start, u64 len, int nid)
return 0;
}
-static int __init
-count_reserved_pages(u64 start, u64 end, void *arg)
-{
- unsigned long num_reserved = 0;
- unsigned long *count = arg;
-
- for (; start < end; start += PAGE_SIZE)
- if (PageReserved(virt_to_page(start)))
- ++num_reserved;
- *count += num_reserved;
- return 0;
-}
-
int
find_max_min_low_pfn (u64 start, u64 end, void *arg)
{
@@ -597,7 +584,6 @@ __setup("nolwsys", nolwsys_setup);
void __init
mem_init (void)
{
- long reserved_pages, codesize, datasize, initsize;
pg_data_t *pgdat;
int i;
@@ -625,18 +611,7 @@ mem_init (void)
if (pgdat->bdata->node_bootmem_map)
free_all_bootmem_node(pgdat);
- reserved_pages = 0;
- efi_memmap_walk(count_reserved_pages, &reserved_pages);
-
- codesize = (unsigned long) _etext - (unsigned long) _stext;
- datasize = (unsigned long) _edata - (unsigned long) _etext;
- initsize = (unsigned long) __init_end - (unsigned long) __init_begin;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%luk code, %luk reserved, "
- "%luk data, %luk init)\n", nr_free_pages() << (PAGE_SHIFT - 10),
- num_physpages << (PAGE_SHIFT - 10), codesize >> 10,
- reserved_pages << (PAGE_SHIFT - 10), datasize >> 10, initsize >> 10);
-
+ mem_init_print_info(NULL);
/*
* For fsyscall entrpoints with no light-weight handler, use the ordinary
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 23/41] mm/m32r: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (21 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 22/41] mm/IA64: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 24/41] mm/m68k: " Jiang Liu
` (17 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Hirokazu Takata, linux-m32r, linux-m32r-ja
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: linux-m32r@ml.linux-m32r.org
Cc: linux-m32r-ja@ml.linux-m32r.org
Cc: linux-kernel@vger.kernel.org
---
arch/m32r/mm/discontig.c | 6 +-----
arch/m32r/mm/init.c | 49 +++++-----------------------------------------
2 files changed, 6 insertions(+), 49 deletions(-)
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index 2c468e8..2719630 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -129,11 +129,10 @@ unsigned long __init setup_memory(void)
#define START_PFN(nid) (NODE_DATA(nid)->bdata->node_min_pfn)
#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn)
-unsigned long __init zone_sizes_init(void)
+void __init zone_sizes_init(void)
{
unsigned long zones_size[MAX_NR_ZONES], zholes_size[MAX_NR_ZONES];
unsigned long low, start_pfn;
- unsigned long holes = 0;
int nid, i;
mem_prof_t *mp;
@@ -147,7 +146,6 @@ unsigned long __init zone_sizes_init(void)
low = MAX_LOW_PFN(nid);
zones_size[ZONE_DMA] = low - start_pfn;
zholes_size[ZONE_DMA] = mp->holes;
- holes += zholes_size[ZONE_DMA];
node_set_state(nid, N_NORMAL_MEMORY);
free_area_init_node(nid, zones_size, start_pfn, zholes_size);
@@ -161,6 +159,4 @@ unsigned long __init zone_sizes_init(void)
NODE_DATA(1)->node_zones->watermark[WMARK_MIN] = 0;
NODE_DATA(1)->node_zones->watermark[WMARK_LOW] = 0;
NODE_DATA(1)->node_zones->watermark[WMARK_HIGH] = 0;
-
- return holes;
}
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index c421c31..9c94839 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -40,7 +40,6 @@ unsigned long mmu_context_cache_dat;
#else
unsigned long mmu_context_cache_dat[NR_CPUS];
#endif
-static unsigned long hole_pages;
/*
* function prototype
@@ -57,7 +56,7 @@ void free_initrd_mem(unsigned long, unsigned long);
#define MAX_LOW_PFN(nid) (NODE_DATA(nid)->bdata->node_low_pfn)
#ifndef CONFIG_DISCONTIGMEM
-unsigned long __init zone_sizes_init(void)
+void __init zone_sizes_init(void)
{
unsigned long zones_size[MAX_NR_ZONES] = {0, };
unsigned long max_dma;
@@ -83,11 +82,9 @@ unsigned long __init zone_sizes_init(void)
#endif /* CONFIG_MMU */
free_area_init_node(0, zones_size, start_pfn, 0);
-
- return 0;
}
#else /* CONFIG_DISCONTIGMEM */
-extern unsigned long zone_sizes_init(void);
+extern void zone_sizes_init(void);
#endif /* CONFIG_DISCONTIGMEM */
/*======================================================================*
@@ -105,24 +102,7 @@ void __init paging_init(void)
for (i = 0 ; i < USER_PTRS_PER_PGD * 2 ; i++)
pgd_val(pg_dir[i]) = 0;
#endif /* CONFIG_MMU */
- hole_pages = zone_sizes_init();
-}
-
-int __init reservedpages_count(void)
-{
- int reservedpages, nid, i;
-
- reservedpages = 0;
- for_each_online_node(nid) {
- unsigned long flags;
- pgdat_resize_lock(NODE_DATA(nid), &flags);
- for (i = 0 ; i < MAX_LOW_PFN(nid) - START_PFN(nid) ; i++)
- if (PageReserved(nid_page_nr(nid, i)))
- reservedpages++;
- pgdat_resize_unlock(NODE_DATA(nid), &flags);
- }
-
- return reservedpages;
+ zone_sizes_init();
}
/*======================================================================*
@@ -131,20 +111,13 @@ int __init reservedpages_count(void)
*======================================================================*/
void __init mem_init(void)
{
- int codesize, reservedpages, datasize, initsize;
int nid;
#ifndef CONFIG_MMU
extern unsigned long memory_end;
#endif
- num_physpages = 0;
- for_each_online_node(nid)
- num_physpages += MAX_LOW_PFN(nid) - START_PFN(nid) + 1;
-
- num_physpages -= hole_pages;
-
#ifndef CONFIG_DISCONTIGMEM
- max_mapnr = num_physpages;
+ max_mapnr = get_num_physpages();
#endif /* CONFIG_DISCONTIGMEM */
#ifdef CONFIG_MMU
@@ -160,19 +133,7 @@ void __init mem_init(void)
for_each_online_node(nid)
free_all_bootmem_node(NODE_DATA(nid));
- reservedpages = reservedpages_count() - hole_pages;
- codesize = (unsigned long) &_etext - (unsigned long)&_text;
- datasize = (unsigned long) &_edata - (unsigned long)&_etext;
- initsize = (unsigned long) &__init_end - (unsigned long)&__init_begin;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
- "%dk reserved, %dk data, %dk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10);
+ mem_init_print_info(NULL);
}
/*======================================================================*
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 24/41] mm/m68k: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (22 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 23/41] mm/m32r: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 25/41] mm/metag: " Jiang Liu
` (16 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Geert Uytterhoeven, linux-m68k
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-kernel@vger.kernel.org
---
arch/m68k/mm/init.c | 31 ++-----------------------------
1 file changed, 2 insertions(+), 29 deletions(-)
diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c
index 2485a8c..0723141 100644
--- a/arch/m68k/mm/init.c
+++ b/arch/m68k/mm/init.c
@@ -149,33 +149,11 @@ void __init print_memmap(void)
void __init mem_init(void)
{
pg_data_t *pgdat;
- int codepages = 0;
- int datapages = 0;
- int initpages = 0;
int i;
/* this will put all memory onto the freelists */
- num_physpages = 0;
- for_each_online_pgdat(pgdat) {
- num_physpages += pgdat->node_present_pages;
-
+ for_each_online_pgdat(pgdat)
free_all_bootmem_node(pgdat);
- for (i = 0; i < pgdat->node_spanned_pages; i++) {
- struct page *page = pgdat->node_mem_map + i;
- char *addr = page_to_virt(page);
-
- if (!PageReserved(page))
- continue;
- if (addr >= _text &&
- addr < _etext)
- codepages++;
- else if (addr >= __init_begin &&
- addr < __init_end)
- initpages++;
- else
- datapages++;
- }
- }
#if defined(CONFIG_MMU) && !defined(CONFIG_SUN3) && !defined(CONFIG_COLDFIRE)
/* insert pointer tables allocated so far into the tablelist */
@@ -190,12 +168,7 @@ void __init mem_init(void)
init_pointer_table((unsigned long)zero_pgtable);
#endif
- pr_info("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- totalram_pages << (PAGE_SHIFT-10),
- codepages << (PAGE_SHIFT-10),
- datapages << (PAGE_SHIFT-10),
- initpages << (PAGE_SHIFT-10));
+ mem_init_print_info(NULL);
print_memmap();
}
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 25/41] mm/metag: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (23 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 24/41] mm/m68k: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 26/41] mm/microblaze: " Jiang Liu
` (15 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
---
arch/metag/mm/init.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/arch/metag/mm/init.c b/arch/metag/mm/init.c
index 279d701..e00586f 100644
--- a/arch/metag/mm/init.c
+++ b/arch/metag/mm/init.c
@@ -388,22 +388,16 @@ void __init mem_init(void)
reset_all_zones_managed_pages();
for (tmp = highstart_pfn; tmp < highend_pfn; tmp++)
free_highmem_page(pfn_to_page(tmp));
- num_physpages += totalhigh_pages;
#endif /* CONFIG_HIGHMEM */
for_each_online_node(nid) {
pg_data_t *pgdat = NODE_DATA(nid);
- num_physpages += pgdat->node_present_pages;
-
if (pgdat->node_spanned_pages)
free_all_bootmem_node(pgdat);
}
- pr_info("Memory: %luk/%luk available\n",
- (unsigned long)nr_free_pages() << (PAGE_SHIFT - 10),
- num_physpages << (PAGE_SHIFT - 10));
-
+ mem_init_print_info(NULL);
show_mem(0);
return;
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 26/41] mm/microblaze: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (24 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 25/41] mm/metag: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 27/41] mm/MIPS: " Jiang Liu
` (14 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Michal Simek, microblaze-uclinux
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: microblaze-uclinux@itee.uq.edu.au
Cc: linux-kernel@vger.kernel.org
---
arch/microblaze/mm/init.c | 51 ++++++---------------------------------------
1 file changed, 6 insertions(+), 45 deletions(-)
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index fb7f248..b0a4a36 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -71,24 +71,17 @@ static void __init highmem_init(void)
kmap_prot = PAGE_KERNEL;
}
-static unsigned long highmem_setup(void)
+static void highmem_setup(void)
{
unsigned long pfn;
- unsigned long reservedpages = 0;
for (pfn = max_low_pfn; pfn < max_pfn; ++pfn) {
struct page *page = pfn_to_page(pfn);
/* FIXME not sure about */
- if (memblock_is_reserved(pfn << PAGE_SHIFT))
- continue;
- free_highmem_page(page);
- reservedpages++;
+ if (!memblock_is_reserved(pfn << PAGE_SHIFT))
+ free_highmem_page(page);
}
- pr_info("High memory: %luk\n",
- totalhigh_pages << (PAGE_SHIFT-10));
-
- return reservedpages;
}
#endif /* CONFIG_HIGHMEM */
@@ -167,13 +160,12 @@ void __init setup_memory(void)
* min_low_pfn - the first page (mm/bootmem.c - node_boot_start)
* max_low_pfn
* max_mapnr - the first unused page (mm/bootmem.c - node_low_pfn)
- * num_physpages - number of all pages
*/
/* memory start is from the kernel end (aligned) to higher addr */
min_low_pfn = memory_start >> PAGE_SHIFT; /* minimum for allocation */
/* RAM is assumed contiguous */
- num_physpages = max_mapnr = memory_size >> PAGE_SHIFT;
+ max_mapnr = memory_size >> PAGE_SHIFT;
max_low_pfn = ((u64)memory_start + (u64)lowmem_size) >> PAGE_SHIFT;
max_pfn = ((u64)memory_start + (u64)memory_size) >> PAGE_SHIFT;
@@ -246,46 +238,15 @@ void free_initmem(void)
void __init mem_init(void)
{
- pg_data_t *pgdat;
- unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
-
high_memory = (void *)__va(memory_start + lowmem_size - 1);
/* this will put all memory onto the freelists */
free_all_bootmem();
-
- for_each_online_pgdat(pgdat) {
- unsigned long i;
- struct page *page;
-
- for (i = 0; i < pgdat->node_spanned_pages; i++) {
- if (!pfn_valid(pgdat->node_start_pfn + i))
- continue;
- page = pgdat_page_nr(pgdat, i);
- if (PageReserved(page))
- reservedpages++;
- }
- }
-
#ifdef CONFIG_HIGHMEM
- reservedpages -= highmem_setup();
+ highmem_setup();
#endif
- codesize = (unsigned long)&_sdata - (unsigned long)&_stext;
- datasize = (unsigned long)&_edata - (unsigned long)&_sdata;
- initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
- bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start;
-
- pr_info("Memory: %luk/%luk available (%luk kernel code, ",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10);
- pr_cont("%luk reserved, %luk data, %luk bss, %luk init)\n",
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- bsssize >> 10,
- initsize >> 10);
-
+ mem_init_print_info(str);
#ifdef CONFIG_MMU
pr_info("Kernel virtual memory layout:\n");
pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 27/41] mm/MIPS: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (25 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 26/41] mm/microblaze: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 28/41] mm/mn10300: " Jiang Liu
` (13 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Ralf Baechle, David Daney, Arnd Bergmann,
Jiri Kosina, John Crispin, Greg Kroah-Hartman, linux-mips
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: David Daney <david.daney@cavium.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: John Crispin <blogic@openwrt.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
---
arch/mips/mm/init.c | 57 ++++++++++++--------------------------
arch/mips/pci/pci-lantiq.c | 2 +-
arch/mips/sgi-ip27/ip27-memory.c | 21 ++------------
3 files changed, 21 insertions(+), 59 deletions(-)
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index de4ff2f..0392a1a 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -358,11 +358,24 @@ void __init paging_init(void)
static struct kcore_list kcore_kseg0;
#endif
-void __init mem_init(void)
+static inline void mem_init_free_highmem(void)
{
- unsigned long codesize, reservedpages, datasize, initsize;
- unsigned long tmp, ram;
+#ifdef CONFIG_HIGHMEM
+ unsigned long tmp;
+ for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
+ struct page *page = pfn_to_page(tmp);
+
+ if (!page_is_ram(tmp))
+ SetPageReserved(page);
+ else
+ free_highmem_page(page);
+ }
+#endif
+}
+
+void __init mem_init(void)
+{
#ifdef CONFIG_HIGHMEM
#ifdef CONFIG_DISCONTIGMEM
#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"
@@ -375,32 +388,8 @@ void __init mem_init(void)
free_all_bootmem();
setup_zero_pages(); /* Setup zeroed pages. */
-
- reservedpages = ram = 0;
- for (tmp = 0; tmp < max_low_pfn; tmp++)
- if (page_is_ram(tmp) && pfn_valid(tmp)) {
- ram++;
- if (PageReserved(pfn_to_page(tmp)))
- reservedpages++;
- }
- num_physpages = ram;
-
-#ifdef CONFIG_HIGHMEM
- for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
- struct page *page = pfn_to_page(tmp);
-
- if (!page_is_ram(tmp)) {
- SetPageReserved(page);
- continue;
- }
- free_highmem_page(page);
- }
- num_physpages += totalhigh_pages;
-#endif
-
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
+ mem_init_free_highmem();
+ mem_init_print_info(NULL);
#ifdef CONFIG_64BIT
if ((unsigned long) &_text > (unsigned long) CKSEG0)
@@ -409,16 +398,6 @@ void __init mem_init(void)
kclist_add(&kcore_kseg0, (void *) CKSEG0,
0x80000000 - 4, KCORE_TEXT);
#endif
-
- printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
- "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- ram << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10,
- totalhigh_pages << (PAGE_SHIFT-10));
}
#endif /* !CONFIG_NEED_MULTIPLE_NODES */
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index 879077b..cb1ef99 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -89,7 +89,7 @@ static inline u32 ltq_calc_bar11mask(void)
u32 mem, bar11mask;
/* BAR11MASK value depends on available memory on system. */
- mem = num_physpages * PAGE_SIZE;
+ mem = get_num_physpages() * PAGE_SIZE;
bar11mask = (0x0ffffff0 & ~((1 << (fls(mem) - 1)) - 1)) | 8;
return bar11mask;
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index 936e617..d074680 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -357,8 +357,6 @@ static void __init szmem(void)
int slot;
cnodeid_t node;
- num_physpages = 0;
-
for_each_online_node(node) {
nodebytes = 0;
for (slot = 0; slot < MAX_MEM_SLOTS; slot++) {
@@ -381,7 +379,6 @@ static void __init szmem(void)
slot = MAX_MEM_SLOTS;
continue;
}
- num_physpages += slot_psize;
memblock_add_node(PFN_PHYS(slot_getbasepfn(node, slot)),
PFN_PHYS(slot_psize), node);
}
@@ -480,10 +477,9 @@ void __init paging_init(void)
void __init mem_init(void)
{
- unsigned long codesize, datasize, initsize, tmp;
unsigned node;
- high_memory = (void *) __va(num_physpages << PAGE_SHIFT);
+ high_memory = (void *) __va(get_num_physpages() << PAGE_SHIFT);
for_each_online_node(node) {
/*
@@ -494,18 +490,5 @@ void __init mem_init(void)
setup_zero_pages(); /* This comes from node 0 */
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- tmp = nr_free_pages();
- printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
- "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
- tmp << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- (num_physpages - tmp) << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10,
- totalhigh_pages << (PAGE_SHIFT-10));
+ mem_init_print_info(NULL);
}
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 28/41] mm/mn10300: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (26 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 27/41] mm/MIPS: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 29/41] mm/openrisc: " Jiang Liu
` (12 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Koichi Yasutake, linux-am33-list
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Cc: linux-am33-list@redhat.com
Cc: linux-kernel@vger.kernel.org
---
arch/mn10300/mm/init.c | 26 ++------------------------
1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c
index d7312aa..f43d993 100644
--- a/arch/mn10300/mm/init.c
+++ b/arch/mn10300/mm/init.c
@@ -99,15 +99,12 @@ void __init paging_init(void)
*/
void __init mem_init(void)
{
- int codesize, reservedpages, datasize, initsize;
- int tmp;
-
BUG_ON(!mem_map);
#define START_PFN (contig_page_data.bdata->node_min_pfn)
#define MAX_LOW_PFN (contig_page_data.bdata->node_low_pfn)
- max_mapnr = num_physpages = MAX_LOW_PFN - START_PFN;
+ max_mapnr = MAX_LOW_PFN - START_PFN;
high_memory = (void *) __va(MAX_LOW_PFN * PAGE_SIZE);
/* clear the zero-page */
@@ -116,26 +113,7 @@ void __init mem_init(void)
/* this will put all low memory onto the freelists */
free_all_bootmem();
- reservedpages = 0;
- for (tmp = 0; tmp < num_physpages; tmp++)
- if (PageReserved(&mem_map[tmp]))
- reservedpages++;
-
- codesize = (unsigned long) &_etext - (unsigned long) &_stext;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk(KERN_INFO
- "Memory: %luk/%luk available"
- " (%dk kernel code, %dk reserved, %dk data, %dk init,"
- " %ldk highmem)\n",
- nr_free_pages() << (PAGE_SHIFT - 10),
- max_mapnr << (PAGE_SHIFT - 10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT - 10),
- datasize >> 10,
- initsize >> 10,
- totalhigh_pages << (PAGE_SHIFT - 10));
+ mem_init_print_info(NULL);
}
/*
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 29/41] mm/openrisc: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (27 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 28/41] mm/mn10300: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 30/41] mm/PARISC: " Jiang Liu
` (11 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Arnd Bergmann, linux
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Jonas Bonn <jonas@southpole.se>
Cc: David Howells <dhowells@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: linux@lists.openrisc.net
Cc: linux-kernel@vger.kernel.org
---
arch/openrisc/mm/init.c | 44 ++++----------------------------------------
1 file changed, 4 insertions(+), 40 deletions(-)
diff --git a/arch/openrisc/mm/init.c b/arch/openrisc/mm/init.c
index da26482..ac438ab 100644
--- a/arch/openrisc/mm/init.c
+++ b/arch/openrisc/mm/init.c
@@ -202,56 +202,20 @@ void __init paging_init(void)
/* References to section boundaries */
-static int __init free_pages_init(void)
-{
- int reservedpages, pfn;
-
- /* this will put all low memory onto the freelists */
- free_all_bootmem();
-
- reservedpages = 0;
- for (pfn = 0; pfn < max_low_pfn; pfn++) {
- /*
- * Only count reserved RAM pages
- */
- if (PageReserved(mem_map + pfn))
- reservedpages++;
- }
-
- return reservedpages;
-}
-
-static void __init set_max_mapnr_init(void)
-{
- max_mapnr = num_physpages = max_low_pfn;
-}
-
void __init mem_init(void)
{
- int codesize, reservedpages, datasize, initsize;
-
BUG_ON(!mem_map);
- set_max_mapnr_init();
-
+ max_mapnr = max_low_pfn;
high_memory = (void *)__va(max_low_pfn * PAGE_SIZE);
/* clear the zero-page */
memset((void *)empty_zero_page, 0, PAGE_SIZE);
- reservedpages = free_pages_init();
-
- codesize = (unsigned long)&_etext - (unsigned long)&_stext;
- datasize = (unsigned long)&_edata - (unsigned long)&_etext;
- initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
+ /* this will put all low memory onto the freelists */
+ free_all_bootmem();
- printk(KERN_INFO
- "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
- (unsigned long)nr_free_pages() << (PAGE_SHIFT - 10),
- max_mapnr << (PAGE_SHIFT - 10), codesize >> 10,
- reservedpages << (PAGE_SHIFT - 10), datasize >> 10,
- initsize >> 10, (unsigned long)(0 << (PAGE_SHIFT - 10))
- );
+ mem_init_print_info(NULL);
printk("mem_init_done ...........................................\n");
mem_init_done = 1;
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 30/41] mm/PARISC: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (28 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 29/41] mm/openrisc: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 31/41] mm/ppc: " Jiang Liu
` (10 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, James E.J. Bottomley, Helge Deller, Thomas Gleixner,
linux-parisc
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>
Cc: linux-parisc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/parisc/mm/init.c | 46 +++-------------------------------------------
1 file changed, 3 insertions(+), 43 deletions(-)
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 1fe9d841..f80c175 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -214,7 +214,6 @@ static void __init setup_bootmem(void)
mem_limit_func(); /* check for "mem=" argument */
mem_max = 0;
- num_physpages = 0;
for (i = 0; i < npmem_ranges; i++) {
unsigned long rsize;
@@ -229,10 +228,8 @@ static void __init setup_bootmem(void)
npmem_ranges = i + 1;
mem_max = mem_limit;
}
- num_physpages += pmem_ranges[i].pages;
break;
}
- num_physpages += pmem_ranges[i].pages;
mem_max += rsize;
}
@@ -532,7 +529,7 @@ void free_initmem(void)
* pages are no-longer executable */
flush_icache_range(init_begin, init_end);
- num_physpages += free_initmem_default(-1);
+ free_initmem_default(-1);
/* set up a new led state on systems shipped LED State panel */
pdc_chassis_send_status(PDC_CHASSIS_DIRECT_BCOMPLETE);
@@ -580,8 +577,6 @@ unsigned long pcxl_dma_start __read_mostly;
void __init mem_init(void)
{
- int codesize, reservedpages, datasize, initsize;
-
/* Do sanity checks on page table constants */
BUILD_BUG_ON(PTE_ENTRY_SIZE != sizeof(pte_t));
BUILD_BUG_ON(PMD_ENTRY_SIZE != sizeof(pmd_t));
@@ -603,33 +598,6 @@ void __init mem_init(void)
}
#endif
- codesize = (unsigned long)_etext - (unsigned long)_text;
- datasize = (unsigned long)_edata - (unsigned long)_etext;
- initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
-
- reservedpages = 0;
-{
- unsigned long pfn;
-#ifdef CONFIG_DISCONTIGMEM
- int i;
-
- for (i = 0; i < npmem_ranges; i++) {
- for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) {
- if (PageReserved(pfn_to_page(pfn)))
- reservedpages++;
- }
- }
-#else /* !CONFIG_DISCONTIGMEM */
- for (pfn = 0; pfn < max_pfn; pfn++) {
- /*
- * Only count reserved RAM pages
- */
- if (PageReserved(pfn_to_page(pfn)))
- reservedpages++;
- }
-#endif
-}
-
#ifdef CONFIG_PA11
if (hppa_dma_ops == &pcxl_dma_ops) {
pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
@@ -643,15 +611,7 @@ void __init mem_init(void)
parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
#endif
- printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10
- );
-
+ mem_init_print_info(NULL);
#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */
printk("virtual kernel memory layout:\n"
" vmalloc : 0x%p - 0x%p (%4ld MB)\n"
@@ -1099,6 +1059,6 @@ void flush_tlb_all(void)
#ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end)
{
- num_physpages += free_reserved_area(start, end, -1, "initrd");
+ free_reserved_area(start, end, -1, "initrd");
}
#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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 31/41] mm/ppc: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (29 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 30/41] mm/PARISC: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-15 0:32 ` Benjamin Herrenschmidt
2013-05-08 15:51 ` [PATCH v5, part4 32/41] mm/s390: " Jiang Liu
` (9 subsequent siblings)
40 siblings, 1 reply; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
linuxppc-dev
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
---
arch/powerpc/mm/mem.c | 56 +++++++++++--------------------------------------
1 file changed, 12 insertions(+), 44 deletions(-)
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index b890245..4e24f1c 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -299,46 +299,27 @@ void __init paging_init(void)
void __init mem_init(void)
{
-#ifdef CONFIG_NEED_MULTIPLE_NODES
- int nid;
-#endif
- pg_data_t *pgdat;
- unsigned long i;
- struct page *page;
- unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
-
#ifdef CONFIG_SWIOTLB
swiotlb_init(0);
#endif
- num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT;
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
#ifdef CONFIG_NEED_MULTIPLE_NODES
- for_each_online_node(nid) {
- if (NODE_DATA(nid)->node_spanned_pages != 0) {
- printk("freeing bootmem node %d\n", nid);
- free_all_bootmem_node(NODE_DATA(nid));
- }
+ {
+ pg_data_t *pgdat;
+
+ for_each_online_pgdat(pgdat)
+ if (pgdat->node_spanned_pages != 0) {
+ printk("freeing bootmem node %d\n",
+ pgdat->node_id);
+ free_all_bootmem_node(pgdat);
+ }
}
#else
max_mapnr = max_pfn;
free_all_bootmem();
#endif
- for_each_online_pgdat(pgdat) {
- for (i = 0; i < pgdat->node_spanned_pages; i++) {
- if (!pfn_valid(pgdat->node_start_pfn + i))
- continue;
- page = pgdat_page_nr(pgdat, i);
- if (PageReserved(page))
- reservedpages++;
- }
- }
-
- codesize = (unsigned long)&_sdata - (unsigned long)&_stext;
- datasize = (unsigned long)&_edata - (unsigned long)&_sdata;
- initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
- bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start;
#ifdef CONFIG_HIGHMEM
{
@@ -348,13 +329,9 @@ void __init mem_init(void)
for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT;
struct page *page = pfn_to_page(pfn);
- if (memblock_is_reserved(paddr))
- continue;
- free_highmem_page(page);
- reservedpages--;
+ if (!memblock_is_reserved(paddr))
+ free_highmem_page(page);
}
- printk(KERN_DEBUG "High memory: %luk\n",
- totalhigh_pages << (PAGE_SHIFT-10));
}
#endif /* CONFIG_HIGHMEM */
@@ -367,16 +344,7 @@ void __init mem_init(void)
(mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1;
#endif
- printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, "
- "%luk reserved, %luk data, %luk bss, %luk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- bsssize >> 10,
- initsize >> 10);
-
+ mem_init_print_info(NULL);
#ifdef CONFIG_PPC32
pr_info("Kernel virtual memory layout:\n");
pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 31/41] mm/ppc: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:51 ` [PATCH v5, part4 31/41] mm/ppc: " Jiang Liu
@ 2013-05-15 0:32 ` Benjamin Herrenschmidt
2013-05-15 15:49 ` Liu Jiang
0 siblings, 1 reply; 53+ messages in thread
From: Benjamin Herrenschmidt @ 2013-05-15 0:32 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, Sergei Shtylyov, David Howells, Mark Salter,
Jianguo Wu, linux-mm, linux-arch, linux-kernel, Paul Mackerras,
linuxppc-dev
On Wed, 2013-05-08 at 23:51 +0800, Jiang Liu wrote:
> Prepare for removing num_physpages and simplify mem_init().
No objection, I haven't had a chance to actually build/boot test though.
BTW. A recommended way of doing so which is pretty easy even if you
don't have access to powerpc hardware nowadays is to use
qemu-system-ppc64 with -M pseries.
You can find cross compilers for the kernel on kernel.org and you can
feed qemu with some distro installer ISO.
Cheers,
Ben.
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: linux-kernel@vger.kernel.org
> ---
> arch/powerpc/mm/mem.c | 56 +++++++++++--------------------------------------
> 1 file changed, 12 insertions(+), 44 deletions(-)
>
> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index b890245..4e24f1c 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -299,46 +299,27 @@ void __init paging_init(void)
>
> void __init mem_init(void)
> {
> -#ifdef CONFIG_NEED_MULTIPLE_NODES
> - int nid;
> -#endif
> - pg_data_t *pgdat;
> - unsigned long i;
> - struct page *page;
> - unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
> -
> #ifdef CONFIG_SWIOTLB
> swiotlb_init(0);
> #endif
>
> - num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT;
> high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
>
> #ifdef CONFIG_NEED_MULTIPLE_NODES
> - for_each_online_node(nid) {
> - if (NODE_DATA(nid)->node_spanned_pages != 0) {
> - printk("freeing bootmem node %d\n", nid);
> - free_all_bootmem_node(NODE_DATA(nid));
> - }
> + {
> + pg_data_t *pgdat;
> +
> + for_each_online_pgdat(pgdat)
> + if (pgdat->node_spanned_pages != 0) {
> + printk("freeing bootmem node %d\n",
> + pgdat->node_id);
> + free_all_bootmem_node(pgdat);
> + }
> }
> #else
> max_mapnr = max_pfn;
> free_all_bootmem();
> #endif
> - for_each_online_pgdat(pgdat) {
> - for (i = 0; i < pgdat->node_spanned_pages; i++) {
> - if (!pfn_valid(pgdat->node_start_pfn + i))
> - continue;
> - page = pgdat_page_nr(pgdat, i);
> - if (PageReserved(page))
> - reservedpages++;
> - }
> - }
> -
> - codesize = (unsigned long)&_sdata - (unsigned long)&_stext;
> - datasize = (unsigned long)&_edata - (unsigned long)&_sdata;
> - initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
> - bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start;
>
> #ifdef CONFIG_HIGHMEM
> {
> @@ -348,13 +329,9 @@ void __init mem_init(void)
> for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
> phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT;
> struct page *page = pfn_to_page(pfn);
> - if (memblock_is_reserved(paddr))
> - continue;
> - free_highmem_page(page);
> - reservedpages--;
> + if (!memblock_is_reserved(paddr))
> + free_highmem_page(page);
> }
> - printk(KERN_DEBUG "High memory: %luk\n",
> - totalhigh_pages << (PAGE_SHIFT-10));
> }
> #endif /* CONFIG_HIGHMEM */
>
> @@ -367,16 +344,7 @@ void __init mem_init(void)
> (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1;
> #endif
>
> - printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, "
> - "%luk reserved, %luk data, %luk bss, %luk init)\n",
> - nr_free_pages() << (PAGE_SHIFT-10),
> - num_physpages << (PAGE_SHIFT-10),
> - codesize >> 10,
> - reservedpages << (PAGE_SHIFT-10),
> - datasize >> 10,
> - bsssize >> 10,
> - initsize >> 10);
> -
> + mem_init_print_info(NULL);
> #ifdef CONFIG_PPC32
> pr_info("Kernel virtual memory layout:\n");
> pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 31/41] mm/ppc: prepare for removing num_physpages and simplify mem_init()
2013-05-15 0:32 ` Benjamin Herrenschmidt
@ 2013-05-15 15:49 ` Liu Jiang
0 siblings, 0 replies; 53+ messages in thread
From: Liu Jiang @ 2013-05-15 15:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, Sergei Shtylyov, David Howells, Mark Salter,
Jianguo Wu, linux-mm, linux-arch, linux-kernel, Paul Mackerras,
linuxppc-dev
On Wed 15 May 2013 08:32:34 AM CST, Benjamin Herrenschmidt wrote:
> On Wed, 2013-05-08 at 23:51 +0800, Jiang Liu wrote:
>> Prepare for removing num_physpages and simplify mem_init().
>
> No objection, I haven't had a chance to actually build/boot test though.
>
> BTW. A recommended way of doing so which is pretty easy even if you
> don't have access to powerpc hardware nowadays is to use
> qemu-system-ppc64 with -M pseries.
>
> You can find cross compilers for the kernel on kernel.org and you can
> feed qemu with some distro installer ISO.
Hi Benjamin,'
Thanks for review! As could I assume an "Acked-by"?
I have installed all cross-compiler from ftp.kernel.org and done
basic
building tests for these patches. But I haven't run new kernel with qemu
yet, that's a really good suggestion, will try it next time.
Regards!
Gerry
>
> Cheers,
> Ben.
>
>> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> Cc: Paul Mackerras <paulus@samba.org>
>> Cc: linuxppc-dev@lists.ozlabs.org
>> Cc: linux-kernel@vger.kernel.org
>> ---
>> arch/powerpc/mm/mem.c | 56 +++++++++++--------------------------------------
>> 1 file changed, 12 insertions(+), 44 deletions(-)
>>
>> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
>> index b890245..4e24f1c 100644
>> --- a/arch/powerpc/mm/mem.c
>> +++ b/arch/powerpc/mm/mem.c
>> @@ -299,46 +299,27 @@ void __init paging_init(void)
>>
>> void __init mem_init(void)
>> {
>> -#ifdef CONFIG_NEED_MULTIPLE_NODES
>> - int nid;
>> -#endif
>> - pg_data_t *pgdat;
>> - unsigned long i;
>> - struct page *page;
>> - unsigned long reservedpages = 0, codesize, initsize, datasize, bsssize;
>> -
>> #ifdef CONFIG_SWIOTLB
>> swiotlb_init(0);
>> #endif
>>
>> - num_physpages = memblock_phys_mem_size() >> PAGE_SHIFT;
>> high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
>>
>> #ifdef CONFIG_NEED_MULTIPLE_NODES
>> - for_each_online_node(nid) {
>> - if (NODE_DATA(nid)->node_spanned_pages != 0) {
>> - printk("freeing bootmem node %d\n", nid);
>> - free_all_bootmem_node(NODE_DATA(nid));
>> - }
>> + {
>> + pg_data_t *pgdat;
>> +
>> + for_each_online_pgdat(pgdat)
>> + if (pgdat->node_spanned_pages != 0) {
>> + printk("freeing bootmem node %d\n",
>> + pgdat->node_id);
>> + free_all_bootmem_node(pgdat);
>> + }
>> }
>> #else
>> max_mapnr = max_pfn;
>> free_all_bootmem();
>> #endif
>> - for_each_online_pgdat(pgdat) {
>> - for (i = 0; i < pgdat->node_spanned_pages; i++) {
>> - if (!pfn_valid(pgdat->node_start_pfn + i))
>> - continue;
>> - page = pgdat_page_nr(pgdat, i);
>> - if (PageReserved(page))
>> - reservedpages++;
>> - }
>> - }
>> -
>> - codesize = (unsigned long)&_sdata - (unsigned long)&_stext;
>> - datasize = (unsigned long)&_edata - (unsigned long)&_sdata;
>> - initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
>> - bsssize = (unsigned long)&__bss_stop - (unsigned long)&__bss_start;
>>
>> #ifdef CONFIG_HIGHMEM
>> {
>> @@ -348,13 +329,9 @@ void __init mem_init(void)
>> for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
>> phys_addr_t paddr = (phys_addr_t)pfn << PAGE_SHIFT;
>> struct page *page = pfn_to_page(pfn);
>> - if (memblock_is_reserved(paddr))
>> - continue;
>> - free_highmem_page(page);
>> - reservedpages--;
>> + if (!memblock_is_reserved(paddr))
>> + free_highmem_page(page);
>> }
>> - printk(KERN_DEBUG "High memory: %luk\n",
>> - totalhigh_pages << (PAGE_SHIFT-10));
>> }
>> #endif /* CONFIG_HIGHMEM */
>>
>> @@ -367,16 +344,7 @@ void __init mem_init(void)
>> (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) - 1;
>> #endif
>>
>> - printk(KERN_INFO "Memory: %luk/%luk available (%luk kernel code, "
>> - "%luk reserved, %luk data, %luk bss, %luk init)\n",
>> - nr_free_pages() << (PAGE_SHIFT-10),
>> - num_physpages << (PAGE_SHIFT-10),
>> - codesize >> 10,
>> - reservedpages << (PAGE_SHIFT-10),
>> - datasize >> 10,
>> - bsssize >> 10,
>> - initsize >> 10);
>> -
>> + mem_init_print_info(NULL);
>> #ifdef CONFIG_PPC32
>> pr_info("Kernel virtual memory layout:\n");
>> pr_info(" * 0x%08lx..0x%08lx : fixmap\n", FIXADDR_START, FIXADDR_TOP);
>
>
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5, part4 32/41] mm/s390: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (30 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 31/41] mm/ppc: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 33/41] mm/score: " Jiang Liu
` (8 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Martin Schwidefsky, Heiko Carstens, linux390,
linux-s390
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/s390/mm/init.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 24d52aa..771c27a 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -133,9 +133,7 @@ void __init paging_init(void)
void __init mem_init(void)
{
- unsigned long codesize, reservedpages, datasize, initsize;
-
- max_mapnr = num_physpages = max_low_pfn;
+ max_mapnr = max_low_pfn;
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
/* Setup guest page hinting */
@@ -145,18 +143,7 @@ void __init mem_init(void)
free_all_bootmem();
setup_zero_pages(); /* Setup zeroed pages. */
- reservedpages = 0;
-
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
- printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, %ldk data, %ldk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- max_mapnr << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >>10,
- initsize >> 10);
+ mem_init_print_info(NULL);
printk("Write protected kernel read-only data: %#lx - %#lx\n",
(unsigned long)&_stext,
PFN_ALIGN((unsigned long)&_eshared) - 1);
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 33/41] mm/score: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (31 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 32/41] mm/s390: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 34/41] mm/SH: " Jiang Liu
` (7 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Chen Liqin, Lennox Wu
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
Cc: Lennox Wu <lennox.wu@gmail.com>
Cc: linux-kernel@vger.kernel.org
---
arch/score/mm/init.c | 26 ++------------------------
1 file changed, 2 insertions(+), 24 deletions(-)
diff --git a/arch/score/mm/init.c b/arch/score/mm/init.c
index 579fc4e..2a223d8 100644
--- a/arch/score/mm/init.c
+++ b/arch/score/mm/init.c
@@ -77,33 +77,11 @@ void __init paging_init(void)
void __init mem_init(void)
{
- unsigned long codesize, reservedpages, datasize, initsize;
- unsigned long tmp, ram = 0;
-
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
free_all_bootmem();
setup_zero_page(); /* Setup zeroed pages. */
- reservedpages = 0;
-
- for (tmp = 0; tmp < max_low_pfn; tmp++)
- if (page_is_ram(tmp)) {
- ram++;
- if (PageReserved(pfn_to_page(tmp)))
- reservedpages++;
- }
-
- num_physpages = ram;
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
- "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
- (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
- ram << (PAGE_SHIFT-10), codesize >> 10,
- reservedpages << (PAGE_SHIFT-10), datasize >> 10,
- initsize >> 10,
- totalhigh_pages << (PAGE_SHIFT-10));
+
+ mem_init_print_info(NULL);
}
#endif /* !CONFIG_NEED_MULTIPLE_NODES */
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 34/41] mm/SH: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (32 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 33/41] mm/score: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 35/41] mm/SPARC: " Jiang Liu
` (6 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Paul Mundt, Tang Chen, linux-sh
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: linux-sh@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/sh/mm/init.c | 25 ++++---------------------
1 file changed, 4 insertions(+), 21 deletions(-)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index aecd913..3826596 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -407,24 +407,18 @@ unsigned int mem_init_done = 0;
void __init mem_init(void)
{
- int codesize, datasize, initsize;
- int nid;
+ pg_data_t *pgdat;
iommu_init();
- num_physpages = 0;
high_memory = NULL;
- for_each_online_node(nid) {
- pg_data_t *pgdat = NODE_DATA(nid);
+ for_each_online_pgdat(pgdat) {
void *node_high_memory;
- num_physpages += pgdat->node_present_pages;
-
if (pgdat->node_spanned_pages)
free_all_bootmem_node(pgdat);
-
node_high_memory = (void *)__va((pgdat->node_start_pfn +
pgdat->node_spanned_pages) <<
PAGE_SHIFT);
@@ -441,19 +435,8 @@ void __init mem_init(void)
vsyscall_init();
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
- "%dk data, %dk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- datasize >> 10,
- initsize >> 10);
-
- printk(KERN_INFO "virtual kernel memory layout:\n"
+ mem_init_print_info(NULL);
+ pr_info("virtual kernel memory layout:\n"
" fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
#ifdef CONFIG_HIGHMEM
" pkmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 35/41] mm/SPARC: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (33 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 34/41] mm/SH: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 19:02 ` Sam Ravnborg
2013-05-08 15:51 ` [PATCH v5, part4 36/41] mm/tile: " Jiang Liu
` (5 subsequent siblings)
40 siblings, 1 reply; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, David S. Miller, Sam Ravnborg, Yasuaki Ishimatsu,
Tang Chen, sparclinux
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: sparclinux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
arch/sparc/kernel/leon_smp.c | 3 ---
arch/sparc/mm/init_32.c | 33 +++------------------------------
arch/sparc/mm/init_64.c | 23 ++---------------------
3 files changed, 5 insertions(+), 54 deletions(-)
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 6cfc1b0..d7aa524 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -254,15 +254,12 @@ void __init leon_smp_done(void)
/* Free unneeded trap tables */
if (!cpu_present(1)) {
free_reserved_page(virt_to_page(&trapbase_cpu1));
- num_physpages++;
}
if (!cpu_present(2)) {
free_reserved_page(virt_to_page(&trapbase_cpu2));
- num_physpages++;
}
if (!cpu_present(3)) {
free_reserved_page(virt_to_page(&trapbase_cpu3));
- num_physpages++;
}
/* Ok, they are spinning and ready to go. */
smp_processors_ready = 1;
diff --git a/arch/sparc/mm/init_32.c b/arch/sparc/mm/init_32.c
index e96afed..25d10cf 100644
--- a/arch/sparc/mm/init_32.c
+++ b/arch/sparc/mm/init_32.c
@@ -288,10 +288,6 @@ static void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
void __init mem_init(void)
{
- int codepages = 0;
- int datapages = 0;
- int initpages = 0;
- int reservedpages = 0;
int i;
if (PKMAP_BASE+LAST_PKMAP*PAGE_SIZE >= FIXADDR_START) {
@@ -329,8 +325,6 @@ void __init mem_init(void)
unsigned long start_pfn = sp_banks[i].base_addr >> PAGE_SHIFT;
unsigned long end_pfn = (sp_banks[i].base_addr + sp_banks[i].num_bytes) >> PAGE_SHIFT;
- num_physpages += sp_banks[i].num_bytes >> PAGE_SHIFT;
-
if (end_pfn <= highstart_pfn)
continue;
@@ -340,39 +334,18 @@ void __init mem_init(void)
map_high_region(start_pfn, end_pfn);
}
- codepages = (((unsigned long) &_etext) - ((unsigned long)&_start));
- codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
- datapages = (((unsigned long) &_edata) - ((unsigned long)&_etext));
- datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT;
- initpages = (((unsigned long) &__init_end) - ((unsigned long) &__init_begin));
- initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
-
- /* Ignore memory holes for the purpose of counting reserved pages */
- for (i=0; i < max_low_pfn; i++)
- if (test_bit(i >> (20 - PAGE_SHIFT), sparc_valid_addr_bitmap)
- && PageReserved(pfn_to_page(i)))
- reservedpages++;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT - 10),
- codepages << (PAGE_SHIFT-10),
- reservedpages << (PAGE_SHIFT - 10),
- datapages << (PAGE_SHIFT-10),
- initpages << (PAGE_SHIFT-10),
- totalhigh_pages << (PAGE_SHIFT-10));
+ mem_init_print_info(NULL);
}
void free_initmem (void)
{
- num_physpages += free_initmem_default(POISON_FREE_INITMEM);
+ free_initmem_default(POISON_FREE_INITMEM);
}
#ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end)
{
- num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM,
- "initrd");
+ free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
}
#endif
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index c93c7c2..b0e6b8f 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -2038,7 +2038,6 @@ static void __init register_page_bootmem_info(void)
}
void __init mem_init(void)
{
- unsigned long codepages, datapages, initpages;
unsigned long addr, last;
addr = PAGE_OFFSET + kern_base;
@@ -2056,11 +2055,6 @@ void __init mem_init(void)
register_page_bootmem_info();
free_all_bootmem();
- /* We subtract one to account for the mem_map_zero page
- * allocated below.
- */
- num_physpages = totalram_pages - 1;
-
/*
* Set up the zero page, mark it reserved, so that page count
* is not manipulated when freeing the page from user ptes.
@@ -2072,19 +2066,7 @@ void __init mem_init(void)
}
mark_page_reserved(mem_map_zero);
- codepages = (((unsigned long) _etext) - ((unsigned long) _start));
- codepages = PAGE_ALIGN(codepages) >> PAGE_SHIFT;
- datapages = (((unsigned long) _edata) - ((unsigned long) _etext));
- datapages = PAGE_ALIGN(datapages) >> PAGE_SHIFT;
- initpages = (((unsigned long) __init_end) - ((unsigned long) __init_begin));
- initpages = PAGE_ALIGN(initpages) >> PAGE_SHIFT;
-
- printk("Memory: %luk available (%ldk kernel code, %ldk data, %ldk init) [%016lx,%016lx]\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- codepages << (PAGE_SHIFT-10),
- datapages << (PAGE_SHIFT-10),
- initpages << (PAGE_SHIFT-10),
- PAGE_OFFSET, (last_valid_pfn << PAGE_SHIFT));
+ mem_init_print_info(NULL);
if (tlb_type == cheetah || tlb_type == cheetah_plus)
cheetah_ecache_flush_init();
@@ -2124,8 +2106,7 @@ void free_initmem(void)
#ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end)
{
- num_physpages += free_reserved_area(start, end, POISON_FREE_INITMEM,
- "initrd");
+ free_reserved_area(start, end, POISON_FREE_INITMEM, "initrd");
}
#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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* Re: [PATCH v5, part4 35/41] mm/SPARC: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:51 ` [PATCH v5, part4 35/41] mm/SPARC: " Jiang Liu
@ 2013-05-08 19:02 ` Sam Ravnborg
0 siblings, 0 replies; 53+ messages in thread
From: Sam Ravnborg @ 2013-05-08 19:02 UTC (permalink / raw)
To: Jiang Liu
Cc: Andrew Morton, Jiang Liu, David Rientjes, Wen Congyang,
Mel Gorman, Minchan Kim, KAMEZAWA Hiroyuki, Michal Hocko,
James Bottomley, Sergei Shtylyov, David Howells, Mark Salter,
Jianguo Wu, linux-mm, linux-arch, linux-kernel, David S. Miller,
Yasuaki Ishimatsu, Tang Chen, sparclinux
On Wed, May 08, 2013 at 11:51:32PM +0800, Jiang Liu wrote:
> Prepare for removing num_physpages and simplify mem_init().
>
> Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
> Cc: Tang Chen <tangchen@cn.fujitsu.com>
> Cc: sparclinux@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
Acked-by: Sam Ravnborg <sam@ravnborg.org>
--
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>
^ permalink raw reply [flat|nested] 53+ messages in thread
* [PATCH v5, part4 36/41] mm/tile: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (34 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 35/41] mm/SPARC: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 37/41] mm/um: " Jiang Liu
` (4 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Bjorn Helgaas, David S. Miller
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Chris Metcalf <cmetcalf@tilera.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org
---
arch/tile/kernel/setup.c | 16 ++++++++--------
arch/tile/mm/init.c | 15 +--------------
2 files changed, 9 insertions(+), 22 deletions(-)
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index 41818e3..68b5426 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -329,6 +329,7 @@ static void __init setup_memory(void)
#if defined(CONFIG_HIGHMEM) || defined(__tilegx__)
long lowmem_pages;
#endif
+ unsigned long physpages = 0;
/* We are using a char to hold the cpu_2_node[] mapping */
BUILD_BUG_ON(MAX_NUMNODES > 127);
@@ -388,8 +389,8 @@ static void __init setup_memory(void)
continue;
}
}
- if (num_physpages + PFN_DOWN(range.size) > maxmem_pfn) {
- int max_size = maxmem_pfn - num_physpages;
+ if (physpages + PFN_DOWN(range.size) > maxmem_pfn) {
+ int max_size = maxmem_pfn - physpages;
if (max_size > 0) {
pr_err("Maxmem reduced node %d to %d pages\n",
i, max_size);
@@ -446,7 +447,7 @@ static void __init setup_memory(void)
node_start_pfn[i] = start;
node_end_pfn[i] = end;
node_controller[i] = range.controller;
- num_physpages += size;
+ physpages += size;
max_pfn = end;
/* Mark node as online */
@@ -465,7 +466,7 @@ static void __init setup_memory(void)
* we're willing to use at 8 million pages (32GB of 4KB pages).
*/
cap = 8 * 1024 * 1024; /* 8 million pages */
- if (num_physpages > cap) {
+ if (physpages > cap) {
int num_nodes = num_online_nodes();
int cap_each = cap / num_nodes;
unsigned long dropped_pages = 0;
@@ -476,10 +477,10 @@ static void __init setup_memory(void)
node_end_pfn[i] = node_start_pfn[i] + cap_each;
}
}
- num_physpages -= dropped_pages;
+ physpages -= dropped_pages;
pr_warning("Only using %ldMB memory;"
" ignoring %ldMB.\n",
- num_physpages >> (20 - PAGE_SHIFT),
+ physpages >> (20 - PAGE_SHIFT),
dropped_pages >> (20 - PAGE_SHIFT));
pr_warning("Consider using a larger page size.\n");
}
@@ -497,7 +498,7 @@ static void __init setup_memory(void)
lowmem_pages = (mappable_physpages > MAXMEM_PFN) ?
MAXMEM_PFN : mappable_physpages;
- highmem_pages = (long) (num_physpages - lowmem_pages);
+ highmem_pages = (long) (physpages - lowmem_pages);
pr_notice("%ldMB HIGHMEM available.\n",
pages_to_mb(highmem_pages > 0 ? highmem_pages : 0));
@@ -514,7 +515,6 @@ static void __init setup_memory(void)
pr_warning("Use a HIGHMEM enabled kernel.\n");
max_low_pfn = MAXMEM_PFN;
max_pfn = MAXMEM_PFN;
- num_physpages = MAXMEM_PFN;
node_end_pfn[0] = MAXMEM_PFN;
} else {
pr_notice("%ldMB memory available.\n",
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index f2ac2f4..e182958 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -821,7 +821,6 @@ static void __init set_max_mapnr_init(void)
void __init mem_init(void)
{
- int codesize, datasize, initsize;
int i;
#ifndef __tilegx__
void *last;
@@ -853,19 +852,7 @@ void __init mem_init(void)
set_non_bootmem_pages_init();
#endif
- codesize = (unsigned long)&_etext - (unsigned long)&_text;
- datasize = (unsigned long)&_end - (unsigned long)&_sdata;
- initsize = (unsigned long)&_einittext - (unsigned long)&_sinittext;
- initsize += (unsigned long)&_einitdata - (unsigned long)&_sinitdata;
-
- pr_info("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init, %ldk highmem)\n",
- (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- datasize >> 10,
- initsize >> 10,
- (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))
- );
+ mem_init_print_info(NULL);
/*
* In debug mode, dump some interesting memory mappings.
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 37/41] mm/um: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (35 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 36/41] mm/tile: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 38/41] mm/unicore32: " Jiang Liu
` (3 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Jeff Dike, Richard Weinberger,
user-mode-linux-devel
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: user-mode-linux-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
---
arch/um/kernel/mem.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index a7dc6c1..819008f 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -70,10 +70,8 @@ void __init mem_init(void)
#ifdef CONFIG_HIGHMEM
setup_highmem(end_iomem, highmem);
#endif
- num_physpages = totalram_pages;
max_pfn = totalram_pages;
- printk(KERN_INFO "Memory: %luk available\n",
- nr_free_pages() << (PAGE_SHIFT-10));
+ mem_init_print_info(NULL);
kmalloc_ok = 1;
}
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 38/41] mm/unicore32: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (36 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 37/41] mm/um: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 39/41] mm/x86: " Jiang Liu
` (2 subsequent siblings)
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Guan Xuetao
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: David Rientjes <rientjes@google.com>
Cc: linux-kernel@vger.kernel.org
---
arch/unicore32/mm/init.c | 49 ++--------------------------------------------
1 file changed, 2 insertions(+), 47 deletions(-)
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index 119b9e8..39a967a 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -383,10 +383,6 @@ static void __init free_unused_memmap(struct meminfo *mi)
*/
void __init mem_init(void)
{
- unsigned long reserved_pages, free_pages;
- struct memblock_region *reg;
- int i;
-
max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
free_unused_memmap(&meminfo);
@@ -394,48 +390,7 @@ void __init mem_init(void)
/* this will put all unused low memory onto the freelists */
free_all_bootmem();
- reserved_pages = free_pages = 0;
-
- for_each_bank(i, &meminfo) {
- struct membank *bank = &meminfo.bank[i];
- unsigned int pfn1, pfn2;
- struct page *page, *end;
-
- pfn1 = bank_pfn_start(bank);
- pfn2 = bank_pfn_end(bank);
-
- page = pfn_to_page(pfn1);
- end = pfn_to_page(pfn2 - 1) + 1;
-
- do {
- if (PageReserved(page))
- reserved_pages++;
- else if (!page_count(page))
- free_pages++;
- page++;
- } while (page < end);
- }
-
- /*
- * Since our memory may not be contiguous, calculate the
- * real number of pages we have in this system
- */
- printk(KERN_INFO "Memory:");
- num_physpages = 0;
- for_each_memblock(memory, reg) {
- unsigned long pages = memblock_region_memory_end_pfn(reg) -
- memblock_region_memory_base_pfn(reg);
- num_physpages += pages;
- printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
- }
- printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
-
- printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- free_pages << (PAGE_SHIFT-10),
- reserved_pages << (PAGE_SHIFT-10),
- totalhigh_pages << (PAGE_SHIFT-10));
-
+ mem_init_print_info(NULL);
printk(KERN_NOTICE "Virtual kernel memory layout:\n"
" vector : 0x%08lx - 0x%08lx (%4ld kB)\n"
" vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
@@ -464,7 +419,7 @@ void __init mem_init(void)
BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
BUG_ON(TASK_SIZE > MODULES_VADDR);
- if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
+ if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
/*
* On a machine this small we won't get
* anywhere without overcommit, so turn
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 39/41] mm/x86: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (37 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 38/41] mm/unicore32: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 40/41] mm/xtensa: " Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 41/41] mm: kill global variable num_physpages Jiang Liu
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
Andreas Herrmann, Tang Chen
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org
Cc: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>
Cc: Wen Congyang <wency@cn.fujitsu.com>
Cc: Jianguo Wu <wujianguo@huawei.com>
Cc: linux-kernel@vger.kernel.org
---
arch/x86/kernel/cpu/amd.c | 2 +-
arch/x86/kernel/setup.c | 2 --
arch/x86/mm/init_32.c | 30 ++----------------------------
arch/x86/mm/init_64.c | 20 +-------------------
arch/x86/mm/numa_32.c | 2 --
5 files changed, 4 insertions(+), 52 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 5013a48..c587a87 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -90,7 +90,7 @@ static void __cpuinit init_amd_k5(struct cpuinfo_x86 *c)
static void __cpuinit init_amd_k6(struct cpuinfo_x86 *c)
{
u32 l, h;
- int mbytes = num_physpages >> (20-PAGE_SHIFT);
+ int mbytes = get_num_physpages() >> (20-PAGE_SHIFT);
if (c->x86_model < 6) {
/* Based on AMD doc 20734R - June 2000 */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index c8dbdfd..58f1a8ad 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -1041,8 +1041,6 @@ void __init setup_arch(char **cmdline_p)
/* max_low_pfn get updated here */
find_low_pfn_range();
#else
- num_physpages = max_pfn;
-
check_x2apic();
/* How many end-of-memory variables you have, grandma! */
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 9fa46ba..4287f1f 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -660,10 +660,8 @@ void __init initmem_init(void)
highstart_pfn = max_low_pfn;
printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
pages_to_mb(highend_pfn - highstart_pfn));
- num_physpages = highend_pfn;
high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
#else
- num_physpages = max_low_pfn;
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
#endif
@@ -671,7 +669,7 @@ void __init initmem_init(void)
sparse_memory_present_with_active_regions(0);
#ifdef CONFIG_FLATMEM
- max_mapnr = num_physpages;
+ max_mapnr = IS_ENABLED(CONFIG_HIGHMEM) ? highend_pfn : max_low_pfn;
#endif
__vmalloc_start_set = true;
@@ -739,9 +737,6 @@ static void __init test_wp_bit(void)
void __init mem_init(void)
{
- int codesize, reservedpages, datasize, initsize;
- int tmp;
-
pci_iommu_alloc();
#ifdef CONFIG_FLATMEM
@@ -761,30 +756,9 @@ void __init mem_init(void)
/* this will put all low memory onto the freelists */
free_all_bootmem();
- reservedpages = 0;
- for (tmp = 0; tmp < max_low_pfn; tmp++)
- /*
- * Only count reserved RAM pages:
- */
- if (page_is_ram(tmp) && PageReserved(pfn_to_page(tmp)))
- reservedpages++;
-
after_bootmem = 1;
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
- printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, "
- "%dk reserved, %dk data, %dk init, %ldk highmem)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- num_physpages << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10,
- totalhigh_pages << (PAGE_SHIFT-10));
-
+ mem_init_print_info(NULL);
printk(KERN_INFO "virtual kernel memory layout:\n"
" fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
#ifdef CONFIG_HIGHMEM
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 65116e5..650264b 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -1043,9 +1043,6 @@ static void __init register_page_bootmem_info(void)
void __init mem_init(void)
{
- long codesize, reservedpages, datasize, initsize;
- unsigned long absent_pages;
-
pci_iommu_alloc();
/* clear_bss() already clear the empty_zero_page */
@@ -1054,28 +1051,13 @@ void __init mem_init(void)
/* this will put all memory onto the freelists */
free_all_bootmem();
-
- absent_pages = absent_pages_in_range(0, max_pfn);
- reservedpages = max_pfn - totalram_pages - absent_pages;
after_bootmem = 1;
- codesize = (unsigned long) &_etext - (unsigned long) &_text;
- datasize = (unsigned long) &_edata - (unsigned long) &_etext;
- initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
-
/* Register memory areas for /proc/kcore */
kclist_add(&kcore_vsyscall, (void *)VSYSCALL_START,
VSYSCALL_END - VSYSCALL_START, KCORE_OTHER);
- printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
- "%ldk absent, %ldk reserved, %ldk data, %ldk init)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- max_pfn << (PAGE_SHIFT-10),
- codesize >> 10,
- absent_pages << (PAGE_SHIFT-10),
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10);
+ mem_init_print_info(NULL);
}
#ifdef CONFIG_DEBUG_RODATA
diff --git a/arch/x86/mm/numa_32.c b/arch/x86/mm/numa_32.c
index 73a6d73..0342d27 100644
--- a/arch/x86/mm/numa_32.c
+++ b/arch/x86/mm/numa_32.c
@@ -83,10 +83,8 @@ void __init initmem_init(void)
highstart_pfn = max_low_pfn;
printk(KERN_NOTICE "%ldMB HIGHMEM available.\n",
pages_to_mb(highend_pfn - highstart_pfn));
- num_physpages = highend_pfn;
high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1;
#else
- num_physpages = max_low_pfn;
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1;
#endif
printk(KERN_NOTICE "%ldMB LOWMEM available.\n",
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 40/41] mm/xtensa: prepare for removing num_physpages and simplify mem_init()
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (38 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 39/41] mm/x86: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
2013-05-08 15:51 ` [PATCH v5, part4 41/41] mm: kill global variable num_physpages Jiang Liu
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Chris Zankel, Max Filippov, Geert Uytterhoeven,
linux-xtensa
Prepare for removing num_physpages and simplify mem_init().
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-xtensa@linux-xtensa.org
Cc: linux-kernel@vger.kernel.org
---
arch/xtensa/mm/init.c | 27 ++-------------------------
1 file changed, 2 insertions(+), 25 deletions(-)
diff --git a/arch/xtensa/mm/init.c b/arch/xtensa/mm/init.c
index dc6e009..267428e 100644
--- a/arch/xtensa/mm/init.c
+++ b/arch/xtensa/mm/init.c
@@ -173,12 +173,8 @@ void __init zones_init(void)
void __init mem_init(void)
{
- unsigned long codesize, reservedpages, datasize, initsize;
- unsigned long highmemsize, tmp, ram;
-
- max_mapnr = num_physpages = max_low_pfn - ARCH_PFN_OFFSET;
+ max_mapnr = max_low_pfn - ARCH_PFN_OFFSET;
high_memory = (void *) __va(max_low_pfn << PAGE_SHIFT);
- highmemsize = 0;
#ifdef CONFIG_HIGHMEM
#error HIGHGMEM not implemented in init.c
@@ -186,26 +182,7 @@ void __init mem_init(void)
free_all_bootmem();
- reservedpages = ram = 0;
- for (tmp = 0; tmp < max_mapnr; tmp++) {
- ram++;
- if (PageReserved(mem_map+tmp))
- reservedpages++;
- }
-
- codesize = (unsigned long) _etext - (unsigned long) _stext;
- datasize = (unsigned long) _edata - (unsigned long) _sdata;
- initsize = (unsigned long) __init_end - (unsigned long) __init_begin;
-
- printk("Memory: %luk/%luk available (%ldk kernel code, %ldk reserved, "
- "%ldk data, %ldk init %ldk highmem)\n",
- nr_free_pages() << (PAGE_SHIFT-10),
- ram << (PAGE_SHIFT-10),
- codesize >> 10,
- reservedpages << (PAGE_SHIFT-10),
- datasize >> 10,
- initsize >> 10,
- highmemsize >> 10);
+ mem_init_print_info(NULL);
}
#ifdef CONFIG_BLK_DEV_INITRD
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread
* [PATCH v5, part4 41/41] mm: kill global variable num_physpages
2013-05-08 15:50 [PATCH v5, part4 00/41] Simplify mem_init() implementations and kill num_physpages Jiang Liu
` (39 preceding siblings ...)
2013-05-08 15:51 ` [PATCH v5, part4 40/41] mm/xtensa: " Jiang Liu
@ 2013-05-08 15:51 ` Jiang Liu
40 siblings, 0 replies; 53+ messages in thread
From: Jiang Liu @ 2013-05-08 15:51 UTC (permalink / raw)
To: Andrew Morton
Cc: Jiang Liu, David Rientjes, Wen Congyang, Mel Gorman, Minchan Kim,
KAMEZAWA Hiroyuki, Michal Hocko, James Bottomley, Sergei Shtylyov,
David Howells, Mark Salter, Jianguo Wu, linux-mm, linux-arch,
linux-kernel, Michel Lespinasse, Rik van Riel, Hugh Dickins,
Al Viro, Konstantin Khlebnikov
Now all references to num_physpages have been removed, so kill it.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michel Lespinasse <walken@google.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Jiang Liu <jiang.liu@huawei.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
---
include/linux/mm.h | 1 -
mm/memory.c | 2 --
mm/nommu.c | 2 --
3 files changed, 5 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 66e5fb8..f02b34f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -29,7 +29,6 @@ struct writeback_control;
extern unsigned long max_mapnr;
#endif
-extern unsigned long num_physpages;
extern unsigned long totalram_pages;
extern void * high_memory;
extern int page_cluster;
diff --git a/mm/memory.c b/mm/memory.c
index f7a1fba..0022366 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -82,7 +82,6 @@ EXPORT_SYMBOL(max_mapnr);
EXPORT_SYMBOL(mem_map);
#endif
-unsigned long num_physpages;
/*
* A number of key systems in x86 including ioremap() rely on the assumption
* that high_memory defines the upper bound on direct map memory, then end
@@ -92,7 +91,6 @@ unsigned long num_physpages;
*/
void * high_memory;
-EXPORT_SYMBOL(num_physpages);
EXPORT_SYMBOL(high_memory);
/*
diff --git a/mm/nommu.c b/mm/nommu.c
index 247ef84..09cfde8 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -56,7 +56,6 @@
void *high_memory;
struct page *mem_map;
unsigned long max_mapnr;
-unsigned long num_physpages;
unsigned long highest_memmap_pfn;
struct percpu_counter vm_committed_as;
int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */
@@ -85,7 +84,6 @@ unsigned long vm_memory_committed(void)
EXPORT_SYMBOL_GPL(vm_memory_committed);
EXPORT_SYMBOL(mem_map);
-EXPORT_SYMBOL(num_physpages);
/* list of mapped, potentially shareable regions */
static struct kmem_cache *vm_region_jar;
--
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>
^ permalink raw reply related [flat|nested] 53+ messages in thread