[PATCH 1/3] um: Use PAGE_ALIGN() for address alignment
Tiwei Bie
tiwei.bie at linux.dev
Sun Oct 26 16:59:10 PDT 2025
From: Tiwei Bie <tiwei.btw at antgroup.com>
Use PAGE_ALIGN() instead of open-coded calculations.
Signed-off-by: Tiwei Bie <tiwei.btw at antgroup.com>
---
arch/um/kernel/um_arch.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index cfbbbf8500c3..4bba77a28454 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -298,10 +298,7 @@ static unsigned long __init get_top_address(char **envp)
top_addr = (unsigned long) envp[i];
}
- top_addr &= ~(UM_KERN_PAGE_SIZE - 1);
- top_addr += UM_KERN_PAGE_SIZE;
-
- return top_addr;
+ return PAGE_ALIGN(top_addr + 1);
}
int __init linux_main(int argc, char **argv, char **envp)
@@ -369,8 +366,8 @@ int __init linux_main(int argc, char **argv, char **envp)
setup_machinename(init_utsname()->machine);
- physmem_size = (physmem_size + PAGE_SIZE - 1) & PAGE_MASK;
- iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
+ physmem_size = PAGE_ALIGN(physmem_size);
+ iomem_size = PAGE_ALIGN(iomem_size);
max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC;
if (physmem_size > max_physmem) {
--
2.34.1
More information about the linux-um
mailing list