[PATCH 3/3] um: Count iomem_size only once in physmem calculation
Tiwei Bie
tiwei.btw at antgroup.com
Thu Nov 28 00:19:39 PST 2024
When calculating max_physmem, we've already factored in the space
used by iomem. We don't need to subtract it again.
Signed-off-by: Tiwei Bie <tiwei.btw at antgroup.com>
---
arch/um/kernel/um_arch.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 62ddb865eb91..221cc89c9bec 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -376,9 +376,8 @@ int __init linux_main(int argc, char **argv, char **envp)
iomem_size = (iomem_size + PAGE_SIZE - 1) & PAGE_MASK;
max_physmem = TASK_SIZE - uml_physmem - iomem_size - MIN_VMALLOC;
-
- if (physmem_size + iomem_size > max_physmem) {
- physmem_size = max_physmem - iomem_size;
+ if (physmem_size > max_physmem) {
+ physmem_size = max_physmem;
os_info("Physical memory size shrunk to %llu bytes\n",
physmem_size);
}
--
2.34.1
More information about the linux-um
mailing list