Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1669957pxj; Wed, 19 May 2021 11:04:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhMgzSAUHHb4QJErIZWrsYjlqE02WDh3p+GoT6xlvu2VEJiH199nzsb+jxISNmpAW1DRhJ X-Received: by 2002:a5d:9f01:: with SMTP id q1mr794438iot.7.1621447495625; Wed, 19 May 2021 11:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621447495; cv=none; d=google.com; s=arc-20160816; b=fGSYxBLOszHeYQPdrYtzfLRHk+1zwaOdBMcSt4R88ms0mb3tt9XmBajSwq/jY7lI+I cddLlTNfXXF1Y4W3EYLKNPgLoYU7369XkgqiwopsDV74Qyj9j2Lmz0q6xu4uBrC2mFnf 7M9nyXLzTtwNN91/8nTvtDGvrHxI3D9gvKGCy88Au0oYgrLOEQsGGVbQBWw6vziZZgn3 VeNIBfwFM14/MLC9MU+582bhzYn9K+MIC0TJcdPlSAVEh2ZP+/Elfxisk6Z+7bWsOisX mLzB/KYxzjAZyaggyWc8dJiVRouILfCdI5g70GylKS3njJRjhekeekIdtWpk+3KXYHbZ fo5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=hTF+YIpqNQ+WPQ0k08ocz/wpK6+OEUGLkUueFrzV3NE=; b=vzmiIQgiLnN6g/p+sesPuDWQHVYP0VIE6oW/qeG042rayFWrv2zbG0a8zrxsVPZG5L vQj75TzaEs9l+GRMr9qF070KwpeFmafDipn+EBS7qDlnn/Lvey/KQzLmrAI2R+oXUXlh 7NGW+X1vnHqVo/3gspvAuHFhAVf0neYHm7EnHb1XrBZrFCD6fZjwHuBkPLnsz3uhziJT CAG8Ma3pJZdF14zI0kp2xPsvt73/5zcV8UkT2PZ17byco7UOoewEyzKHUhF7T0Qy0kPI eJVam6PzrN+Vmh2I50hNxwq2B1DkSaapQIzlqW2TYmDbaVcrftWODnLYE8dBuTvQDXLO r4Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ig1+8cQq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h31si28408789jav.116.2021.05.19.11.04.36; Wed, 19 May 2021 11:04:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=ig1+8cQq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245501AbhERMRI (ORCPT + 99 others); Tue, 18 May 2021 08:17:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245356AbhERMRH (ORCPT ); Tue, 18 May 2021 08:17:07 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7604CC061573 for ; Tue, 18 May 2021 05:15:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hTF+YIpqNQ+WPQ0k08ocz/wpK6+OEUGLkUueFrzV3NE=; b=ig1+8cQqoBmYEJRq7myeZ3yX6q KjXPTVap9hkpzTwyNd6pt3RaAn/km3U+BKOHU1WRLMVC+X5H5zodKIJi95BBpnX/NxMdOp0C+bSqn 7OPQcwrdPW9oWVz6QP1l1j3VdPNkJ4xln5Gqf23h3p70jHSMeQStLm2oa6imWFFF5oSxyBMeVjI5C 1mqmEKf03aVeAhnDaHNiwWUQn41tPRC28230mVDcmVusrqQQx0ZLRtR6jyQTaX9woHPr+WqOrT6py QxVxFBCMlckeouQqJ6hB7tsf/AQ7p/NJeuh+h8blpiEvawC01QuWm6cG9DP38HwAbzrZH9B/ySL2f 69/QC5vA==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:55064 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1liydV-0004Gd-OP; Tue, 18 May 2021 13:15:45 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1liydV-0004rQ-Ed; Tue, 18 May 2021 13:15:45 +0100 In-Reply-To: <20210518120633.GW12395@shell.armlinux.org.uk> References: <20210518120633.GW12395@shell.armlinux.org.uk> From: "Russell King (Oracle)" To: Yanfei Xu Cc: rppt@kernel.org, ardb@kernel.org, linus.walleij@linaro.org, akpm@linux-foundation.org, carver4lio@163.com, tiantao6@hisilicon.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] ARM: use a temporary variable to hold maximum vmalloc size MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Tue, 18 May 2021 13:15:45 +0100 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We calculate the maximum size of the vmalloc space twice in early_vmalloc(). Use a temporary variable to hold this value. Signed-off-by: Russell King (Oracle) --- 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