linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: make the size of vmalloc in cmdline and meminfo uniform
@ 2021-05-18 11:12 Yanfei Xu
  2021-05-18 11:29 ` Russell King (Oracle)
  0 siblings, 1 reply; 41+ messages in thread
From: Yanfei Xu @ 2021-05-18 11:12 UTC (permalink / raw)
  To: linux, rppt, ardb, linus.walleij, akpm, carver4lio, tiantao6
  Cc: linux-arm-kernel, linux-kernel

The value of "vmalloc=" set in cmdline is always 8M more than the value
of "VmallocTotal" in meminfo. When use the "vmalloc=" parameter, user
expect to get the size what they input, and no need to consider the 8M
"hole" hided in codes. This commit make real vmalloc size equal to value
of "vmalloc=" in cmdline.

Also, the commit will reduce the size of vmalloc printed in boot message
by 8M when the size set in cmdline is irrational.

Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
---
 arch/arm/mm/mmu.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index c1e12aab67b8..287c5115af4d 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -1133,19 +1133,20 @@ static int __init early_vmalloc(char *arg)
 {
 	unsigned long vmalloc_reserve = memparse(arg, NULL);
 
-	if (vmalloc_reserve < SZ_16M) {
-		vmalloc_reserve = SZ_16M;
+	vmalloc_reserve = ALIGN_DOWN(vmalloc_reserve, SZ_8M);
+	if (vmalloc_reserve < SZ_8M) {
+		vmalloc_reserve = SZ_8M;
 		pr_warn("vmalloc area too small, limiting to %luMB\n",
 			vmalloc_reserve >> 20);
 	}
 
 	if (vmalloc_reserve > VMALLOC_END - (PAGE_OFFSET + SZ_32M)) {
-		vmalloc_reserve = VMALLOC_END - (PAGE_OFFSET + SZ_32M);
+		vmalloc_reserve = VMALLOC_END - (PAGE_OFFSET + SZ_32M + VMALLOC_OFFSET);
 		pr_warn("vmalloc area is too big, limiting to %luMB\n",
 			vmalloc_reserve >> 20);
 	}
 
-	vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve);
+	vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve - VMALLOC_OFFSET);
 	return 0;
 }
 early_param("vmalloc", early_vmalloc);
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2021-05-28 13:52 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 11:12 [PATCH] arm: make the size of vmalloc in cmdline and meminfo uniform Yanfei Xu
2021-05-18 11:29 ` Russell King (Oracle)
2021-05-18 12:06   ` Russell King (Oracle)
2021-05-18 12:15     ` [PATCH 1/4] ARM: change vmalloc_min to be unsigned long Russell King (Oracle)
2021-05-18 22:09       ` Linus Walleij
2021-05-18 12:15     ` [PATCH 2/4] ARM: use a temporary variable to hold maximum vmalloc size Russell King (Oracle)
2021-05-18 22:11       ` Linus Walleij
2021-05-18 12:15     ` [PATCH 3/4] ARM: change vmalloc_min to vmalloc_start Russell King (Oracle)
2021-05-18 22:19       ` Linus Walleij
2021-05-18 22:26         ` Nicolas Pitre
2021-05-18 22:32           ` Nicolas Pitre
2021-05-18 22:34             ` Linus Walleij
2021-05-18 22:38               ` Nicolas Pitre
2021-05-28  9:55             ` Russell King (Oracle)
2021-05-19  4:41       ` Xu, Yanfei
2021-05-20  9:00         ` Russell King (Oracle)
2021-05-28  2:52           ` Xu, Yanfei
2021-05-28 10:00             ` Russell King (Oracle)
2021-05-19  5:25       ` Xu, Yanfei
2021-05-18 12:15     ` [PATCH 4/4] ARM: change vmalloc_start to vmalloc_size Russell King (Oracle)
2021-05-18 22:21       ` Linus Walleij
2021-05-19  4:39     ` [PATCH] arm: make the size of vmalloc in cmdline and meminfo uniform Xu, Yanfei
2021-05-19  5:32       ` Xu, Yanfei
2021-05-20  4:52         ` Alexander Dahl
2021-05-20  6:50           ` Xu, Yanfei
2021-05-28 10:11     ` [PATCH v2 1/6] ARM: change vmalloc_min to be unsigned long Russell King (Oracle)
2021-05-28 13:10       ` Xu, Yanfei
2021-05-28 10:11     ` [PATCH v2 2/6] ARM: use a temporary variable to hold maximum vmalloc size Russell King (Oracle)
2021-05-28 13:11       ` Xu, Yanfei
2021-05-28 10:11     ` [PATCH v2 3/6] ARM: change vmalloc_min to vmalloc_start Russell King (Oracle)
2021-05-28 12:21       ` Linus Walleij
2021-05-28 13:05       ` Xu, Yanfei
2021-05-28 10:11     ` [PATCH v2 4/6] ARM: change vmalloc_start to vmalloc_size Russell King (Oracle)
2021-05-28 12:22       ` Linus Walleij
2021-05-28 13:15       ` Xu, Yanfei
2021-05-28 10:11     ` [PATCH v2 5/6] ARM: use "* SZ_1M" rather than "<< 20" Russell King (Oracle)
2021-05-28 12:23       ` Linus Walleij
2021-05-28 13:17       ` Xu, Yanfei
2021-05-28 10:11     ` [PATCH v2 6/6] ARM: use MiB for vmalloc sizes Russell King (Oracle)
2021-05-28 12:24       ` Linus Walleij
2021-05-28 13:20       ` Xu, Yanfei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).