Skip to content

Commit 5a01672

Browse files
authored
Merge pull request #622 from lrh2000/mm-init-const
lkl: initialize mm constants before mem_init()
2 parents 34d8dc9 + 952bb32 commit 5a01672

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/lkl/mm/bootmem.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@ void __init bootmem_init(unsigned long mem_sz)
4646
* Give all the memory to the bootmap allocator, tell it to put the
4747
* boot mem_map at the start of memory.
4848
*/
49-
max_low_pfn = virt_to_pfn((void *)memory_end);
50-
min_low_pfn = virt_to_pfn((void *)memory_start);
5149
memblock_add(__pa(memory_start), mem_size);
5250

51+
max_pfn = max_low_pfn = virt_to_pfn((void *)memory_end);
52+
min_low_pfn = virt_to_pfn((void *)memory_start);
53+
set_max_mapnr(max_pfn - ARCH_PFN_OFFSET);
54+
5355
empty_zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
5456
memset(empty_zero_page, 0, PAGE_SIZE);
5557

@@ -60,9 +62,6 @@ void __init bootmem_init(unsigned long mem_sz)
6062
void __init mem_init(void)
6163
{
6264
memblock_free_all();
63-
max_mapnr = totalram_pages();
64-
max_low_pfn = max_mapnr + ARCH_PFN_OFFSET;
65-
max_pfn = max_mapnr + ARCH_PFN_OFFSET;
6665
}
6766

6867
/*

0 commit comments

Comments
 (0)