aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2010-05-04 12:27:43 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-05-04 12:31:03 -0400
commitea056df7965fc46cfff28fd3808bf3ada23d5059 (patch)
tree4bc56774dfc4217db45ad304a0463532d6ff4808 /arch
parentab92e74f799a1cbc6b3c9bf90ed05403689ddecc (diff)
ARM: 6093/1: Fix kernel memory printing for sparsemem
The show_mem() and mem_init() function are assuming that the page map is contiguous and calculates the start and end page of a bank using (map + pfn). This fails with SPARSEMEM where pfn_to_page() must be used. Tested-by: Will Deacon <Will.Deacon@arm.com> Tested-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mm/init.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 83db12a68d56..0ed29bfeba1c 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -86,9 +86,6 @@ void show_mem(void)
86 printk("Mem-info:\n"); 86 printk("Mem-info:\n");
87 show_free_areas(); 87 show_free_areas();
88 for_each_online_node(node) { 88 for_each_online_node(node) {
89 pg_data_t *n = NODE_DATA(node);
90 struct page *map = pgdat_page_nr(n, 0) - n->node_start_pfn;
91
92 for_each_nodebank (i,mi,node) { 89 for_each_nodebank (i,mi,node) {
93 struct membank *bank = &mi->bank[i]; 90 struct membank *bank = &mi->bank[i];
94 unsigned int pfn1, pfn2; 91 unsigned int pfn1, pfn2;
@@ -97,8 +94,8 @@ void show_mem(void)
97 pfn1 = bank_pfn_start(bank); 94 pfn1 = bank_pfn_start(bank);
98 pfn2 = bank_pfn_end(bank); 95 pfn2 = bank_pfn_end(bank);
99 96
100 page = map + pfn1; 97 page = pfn_to_page(pfn1);
101 end = map + pfn2; 98 end = pfn_to_page(pfn2 - 1) + 1;
102 99
103 do { 100 do {
104 total++; 101 total++;
@@ -603,9 +600,6 @@ void __init mem_init(void)
603 reserved_pages = free_pages = 0; 600 reserved_pages = free_pages = 0;
604 601
605 for_each_online_node(node) { 602 for_each_online_node(node) {
606 pg_data_t *n = NODE_DATA(node);
607 struct page *map = pgdat_page_nr(n, 0) - n->node_start_pfn;
608
609 for_each_nodebank(i, &meminfo, node) { 603 for_each_nodebank(i, &meminfo, node) {
610 struct membank *bank = &meminfo.bank[i]; 604 struct membank *bank = &meminfo.bank[i];
611 unsigned int pfn1, pfn2; 605 unsigned int pfn1, pfn2;
@@ -614,8 +608,8 @@ void __init mem_init(void)
614 pfn1 = bank_pfn_start(bank); 608 pfn1 = bank_pfn_start(bank);
615 pfn2 = bank_pfn_end(bank); 609 pfn2 = bank_pfn_end(bank);
616 610
617 page = map + pfn1; 611 page = pfn_to_page(pfn1);
618 end = map + pfn2; 612 end = pfn_to_page(pfn2 - 1) + 1;
619 613
620 do { 614 do {
621 if (PageReserved(page)) 615 if (PageReserved(page))