Commit 88d34269 authored by Alexander Sverdlin's avatar Alexander Sverdlin Committed by Ralf Baechle
Browse files

MIPS: bootmem: Fix mapstart calculation for contiguous maps

Commit a6335fa1 fixed the case with gap between initrd and next usable PFN zone,
but broken the case when initrd is combined with usable memory into one region
(in add_memory_region()). Restore the fixup initially brought in by f9a7febd


---- error message ----
Unpacking initramfs...
Initramfs unpacking failed: junk in compressed archive
BUG: Bad page state in process swapper  pfn:00261
page:81004c20 count:0 mapcount:-127 mapping:  (null) index:0x2
flags: 0x0()
page dumped because: nonzero mapcount
CPU: 0 PID: 1 Comm: swapper Not tainted 4.2.0+ #1782

Signed-off-by: default avatarAlexander Sverdlin <>
Reported-by: default avatarTony Wu <>
Tested-by: default avatarTony Wu <>
Cc: David Daney <>
Cc: Zubair Lutfullah Kakakhel <>
Cc: Huacai Chen <>
Cc: Joe Perches <>
Cc: Steven J. Hill <>
Cc: Aaro Koskinen <>

Signed-off-by: default avatarRalf Baechle <>
parent fc2ca674
......@@ -338,7 +338,7 @@ static void __init bootmem_init(void)
if (end <= reserved_end)
/* mapstart should be after initrd_end */
/* Skip zones before initrd and initrd itself */
if (initrd_end && end <= (unsigned long)PFN_UP(__pa(initrd_end)))
......@@ -371,6 +371,14 @@ static void __init bootmem_init(void)
max_low_pfn = PFN_DOWN(HIGHMEM_START);
* mapstart should be after initrd_end
if (initrd_end)
mapstart = max(mapstart, (unsigned long)PFN_UP(__pa(initrd_end)));
* Initialize the boot-time allocator with low memory only.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment