]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
um: Count iomem_size only once in physmem calculation
authorTiwei Bie <tiwei.btw@antgroup.com>
Thu, 28 Nov 2024 08:19:39 +0000 (16:19 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 10 Jan 2025 12:49:33 +0000 (13:49 +0100)
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@antgroup.com>
Link: https://patch.msgid.link/20241128081939.2216246-4-tiwei.btw@antgroup.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
arch/um/kernel/um_arch.c

index 8037a967225d82273abaac39f318e1d242d6a12f..c82e26baefc4f0d034783b2a38e371e42c77bb89 100644 (file)
@@ -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);
        }