[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3c7345b9-d963-7d5d-6c6a-6263eb8e2a7c@windriver.com>
Date: Fri, 28 May 2021 21:11:44 +0800
From: "Xu, Yanfei" <yanfei.xu@...driver.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: rppt@...nel.org, ardb@...nel.org, linus.walleij@...aro.org,
akpm@...ux-foundation.org, carver4lio@....com,
tiantao6@...ilicon.com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/6] ARM: use a temporary variable to hold maximum
vmalloc size
On 5/28/21 6:11 PM, Russell King (Oracle) wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
>
> We calculate the maximum size of the vmalloc space twice in
> early_vmalloc(). Use a temporary variable to hold this value.
>
> Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
Reviewed-by: Yanfei Xu <yanfei.xu@...driver.com>
Regards,
Yanfei
> ---
> arch/arm/mm/mmu.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> index 206c345f063e..d932c46a02e0 100644
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
> @@ -1134,6 +1134,7 @@ static unsigned long __initdata vmalloc_min =
> static int __init early_vmalloc(char *arg)
> {
> unsigned long vmalloc_reserve = memparse(arg, NULL);
> + unsigned long vmalloc_max;
>
> if (vmalloc_reserve < SZ_16M) {
> vmalloc_reserve = SZ_16M;
> @@ -1141,8 +1142,9 @@ static int __init early_vmalloc(char *arg)
> vmalloc_reserve >> 20);
> }
>
> - if (vmalloc_reserve > VMALLOC_END - (PAGE_OFFSET + SZ_32M)) {
> - vmalloc_reserve = VMALLOC_END - (PAGE_OFFSET + SZ_32M);
> + vmalloc_max = VMALLOC_END - (PAGE_OFFSET + SZ_32M);
> + if (vmalloc_reserve > vmalloc_max) {
> + vmalloc_reserve = vmalloc_max;
> pr_warn("vmalloc area is too big, limiting to %luMB\n",
> vmalloc_reserve >> 20);
> }
> --
> 2.20.1
>
Powered by blists - more mailing lists