Skip to content

Commit 89f43e1

Browse files
Zhenhua Huangctmarinas
authored andcommitted
arm64: mm: Correct the update of max_pfn
Hotplugged memory can be smaller than the original memory. For example, on my target: root@genericarmv8:~# cat /sys/kernel/debug/memblock/memory 0: 0x0000000064005000..0x0000000064023fff 0 NOMAP 1: 0x0000000064400000..0x00000000647fffff 0 NOMAP 2: 0x0000000068000000..0x000000006fffffff 0 DRV_MNG 3: 0x0000000088800000..0x0000000094ffefff 0 NONE 4: 0x0000000094fff000..0x0000000094ffffff 0 NOMAP max_pfn will affect read_page_owner. Therefore, it should first compare and then select the larger value for max_pfn. Fixes: 8fac67c ("arm64: mm: update max_pfn after memory hotplug") Cc: <[email protected]> # 6.1.x Signed-off-by: Zhenhua Huang <[email protected]> Acked-by: David Hildenbrand <[email protected]> Reviewed-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 64fa6b9 commit 89f43e1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/mm/mmu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1358,7 +1358,8 @@ int arch_add_memory(int nid, u64 start, u64 size,
13581358
__remove_pgd_mapping(swapper_pg_dir,
13591359
__phys_to_virt(start), size);
13601360
else {
1361-
max_pfn = PFN_UP(start + size);
1361+
/* Address of hotplugged memory can be smaller */
1362+
max_pfn = max(max_pfn, PFN_UP(start + size));
13621363
max_low_pfn = max_pfn;
13631364
}
13641365

0 commit comments

Comments
 (0)