diff mbox series

[v3,6/7] mm/memblock: use PAGE_ALIGN_DOWN to get pgend in free_memmap

Message ID 20240507075833.6346-7-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series memblock: cleanup | expand

Commit Message

Wei Yang May 7, 2024, 7:58 a.m. UTC
Leverage the macro PAGE_ALIGN_DOWN to get pgend.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 mm/memblock.c            | 2 +-
 tools/include/linux/mm.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/memblock.c b/mm/memblock.c
index da9a6c862a69..33a8b6f7b626 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -2039,7 +2039,7 @@  static void __init free_memmap(unsigned long start_pfn, unsigned long end_pfn)
 	 * downwards.
 	 */
 	pg = PAGE_ALIGN(__pa(start_pg));
-	pgend = __pa(end_pg) & PAGE_MASK;
+	pgend = PAGE_ALIGN_DOWN(__pa(end_pg));
 
 	/*
 	 * If there are free pages between these, free the section of the
diff --git a/tools/include/linux/mm.h b/tools/include/linux/mm.h
index 7d73da098047..caf68f5084b3 100644
--- a/tools/include/linux/mm.h
+++ b/tools/include/linux/mm.h
@@ -15,6 +15,7 @@ 
 #define ALIGN_DOWN(x, a)		__ALIGN_KERNEL((x) - ((a) - 1), (a))
 
 #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
+#define PAGE_ALIGN_DOWN(addr) ALIGN_DOWN(addr, PAGE_SIZE)
 
 #define __va(x) ((void *)((unsigned long)(x)))
 #define __pa(x) ((unsigned long)(x))