From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C99CC433ED for ; Tue, 18 May 2021 12:15:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 22E4B61261 for ; Tue, 18 May 2021 12:15:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245571AbhERMRI (ORCPT ); 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CD47C433B4 for ; Tue, 18 May 2021 12:17:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DD2AD61028 for ; Tue, 18 May 2021 12:17:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD2AD61028 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Date:Message-Id: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-Owner; bh=SHbihmt88MKDSJmLyDkJ7D+AnMBpw253rwGa6u6VmNE=; b=DFdBIrQIWeBZKEga5X+HvHD3n 7t5qzKbTEgN4BKBc3CNLKo5FpUbCTo12BjgHAK2x1sa3EMOSjXChsUKVk+Kd44X/Vuj2n8bk5mXcn pSrcLr2j/hq2Nzn2Zuq8/hmh4mjRyAY1SnLhkFPwqN2MN1RvLPql5h78u2uqeB9PPTyY/AbtiBKHp fT6v44NUPNpkrcjzTcGtPzvM0QgEt46L1L6woLHLQJkylQo87xOJXXyhFL0jlEOaVKf/GzYd8/wqi XgP3kuJ9x8Fnjz27mLO+4kFdzNTaKr/4rDVlXM1h5b3nZf8qnpgEkDbpTJBKfJozYcVsHqUEPYZOm qm4hfxzAA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liydl-000j2B-9w; Tue, 18 May 2021 12:16:01 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liyda-000j0Q-S6 for linux-arm-kernel@desiato.infradead.org; Tue, 18 May 2021 12:15:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; 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; bh=hTF+YIpqNQ+WPQ0k08ocz/wpK6+OEUGLkUueFrzV3NE=; b=dZ1hJD2EnODMMx13QgD6SvtJ5J nobQCHy6VxG35ef6dc1cbnBS6NPjrxrjo+8ZmdqoD4bzfO6Yptve5uI94UyJpKJAInkIapkjASBMY B6sNzYCVnr1+zS8S52TF/eHWzsWAsfks3euYC1C65NQq8LtNVHehiR/Q6Tg7aKXeZu2emH9ZltOFU FMBenJt4rXOnHoYL70FsglZtgLP4Gco7Um7r/PPQjDLSzBJOe9ob+s306q2ComgRL0KxIPbB4MOZB b3aNS/XvQy5tWysesTA3m0U+cze1I0BS/0zc9qzgIBvAg0WNJRH4X8hRndEXoqt2VzhKc6joTTJMU COeL0ZMA==; Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liydY-00EdnZ-Ea for linux-arm-kernel@lists.infradead.org; Tue, 18 May 2021 12:15:49 +0000 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 Message-Id: Date: Tue, 18 May 2021 13:15:45 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210518_051548_510055_4E729B24 X-CRM114-Status: GOOD ( 12.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel