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>
This commit is contained in:
Родитель
ab92e74f79
Коммит
ea056df796
|
@ -86,9 +86,6 @@ void show_mem(void)
|
|||
printk("Mem-info:\n");
|
||||
show_free_areas();
|
||||
for_each_online_node(node) {
|
||||
pg_data_t *n = NODE_DATA(node);
|
||||
struct page *map = pgdat_page_nr(n, 0) - n->node_start_pfn;
|
||||
|
||||
for_each_nodebank (i,mi,node) {
|
||||
struct membank *bank = &mi->bank[i];
|
||||
unsigned int pfn1, pfn2;
|
||||
|
@ -97,8 +94,8 @@ void show_mem(void)
|
|||
pfn1 = bank_pfn_start(bank);
|
||||
pfn2 = bank_pfn_end(bank);
|
||||
|
||||
page = map + pfn1;
|
||||
end = map + pfn2;
|
||||
page = pfn_to_page(pfn1);
|
||||
end = pfn_to_page(pfn2 - 1) + 1;
|
||||
|
||||
do {
|
||||
total++;
|
||||
|
@ -603,9 +600,6 @@ void __init mem_init(void)
|
|||
reserved_pages = free_pages = 0;
|
||||
|
||||
for_each_online_node(node) {
|
||||
pg_data_t *n = NODE_DATA(node);
|
||||
struct page *map = pgdat_page_nr(n, 0) - n->node_start_pfn;
|
||||
|
||||
for_each_nodebank(i, &meminfo, node) {
|
||||
struct membank *bank = &meminfo.bank[i];
|
||||
unsigned int pfn1, pfn2;
|
||||
|
@ -614,8 +608,8 @@ void __init mem_init(void)
|
|||
pfn1 = bank_pfn_start(bank);
|
||||
pfn2 = bank_pfn_end(bank);
|
||||
|
||||
page = map + pfn1;
|
||||
end = map + pfn2;
|
||||
page = pfn_to_page(pfn1);
|
||||
end = pfn_to_page(pfn2 - 1) + 1;
|
||||
|
||||
do {
|
||||
if (PageReserved(page))
|
||||
|
|
Загрузка…
Ссылка в новой задаче