Skip to content

Commit b73f6b9

Browse files
RichardWeiYangrppt
authored andcommitted
mm/memblock: use PAGE_ALIGN_DOWN to get pgend in free_memmap
Leverage the macro PAGE_ALIGN_DOWN to get pgend. Signed-off-by: Wei Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport (IBM) <[email protected]>
1 parent 1eb0a28 commit b73f6b9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

mm/memblock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,7 @@ static void __init free_memmap(unsigned long start_pfn, unsigned long end_pfn)
20392039
* downwards.
20402040
*/
20412041
pg = PAGE_ALIGN(__pa(start_pg));
2042-
pgend = __pa(end_pg) & PAGE_MASK;
2042+
pgend = PAGE_ALIGN_DOWN(__pa(end_pg));
20432043

20442044
/*
20452045
* If there are free pages between these, free the section of the

tools/include/linux/mm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define PHYS_ADDR_MAX (~(phys_addr_t)0)
1313

1414
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
15+
#define PAGE_ALIGN_DOWN(addr) ALIGN_DOWN(addr, PAGE_SIZE)
1516

1617
#define __va(x) ((void *)((unsigned long)(x)))
1718
#define __pa(x) ((unsigned long)(x))

0 commit comments

Comments
 (0)