Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1663545pxj; Wed, 19 May 2021 10:56:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKOrszHs2IlV3Kd+DAUISlv5fYWPibsZmUCSaM4ao5jsf4f9OnXXI7ZBKveryqiAz8fC58 X-Received: by 2002:a6b:5015:: with SMTP id e21mr760655iob.104.1621447004044; Wed, 19 May 2021 10:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621447004; cv=none; d=google.com; s=arc-20160816; b=JwQYhMmem2X6fGPHt+esWMsMiqnfjzQtPJHsaqw/o/kStfSMN34MaA2FwBF5Nm9m+A 3BcY2IM60gveBNOYWMpejDW8cXCk3G8JhaEcsOovK65/NFBGNHk90sopHdSxjEha2ZTH 0fFcdSHJHrDUGrWAsWOEDbUujbuaj9mSWSv4xnjrbsM+xUdxcnQSnuFO+hsB6CuLBMgP VVkIwrcOPJcffL0R+aIUcZGKFFtiDEcBUQVoGqfSz/EuVGvKrl4X2s5jR4ECyrfTBXyj VzmbYlFr6Arm7Ss5A/84Ckk1ZsEtbEhRP8ZwYrqnLlAvJZmT3/hMJpXElCRUmvCtmkpx EllA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RVUhSCgd6iQAK0YSfHil0g0540QhJdzDOaZHYw4efBo=; b=MugUD2i1AU4OKV5ZkWwXbAKlF0vgFfid754EvTcbuPUaiAbswXVK3vIBJffOMCUiow lWUxxn1D3wpEyb/hXskPM76zcJt60HgsEh6nY18+F6i2b/oFpIdskL3DYqqNwh/b9VWF yqiWw1vVyvmfKu07pDfdFmUSfZQpAl4HprNOGwBmtp2QxpBb5ANUHhqH/+tD4SGvvihA xFe1J9T6aXuA9YDCrp9dLeWEdH5mfTil/h1DFOmuo7bpDZamlO6EjpI9lQaeuNJShGxl 7Jb+J6xLeJXrG+zakmyZ/CoZ+3HMaMSgAgFuiobqtzJpC+0DNEDqy5nsJmnK4CdkB9KV PfWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=tl66YL0J; 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 d2si24064130ios.97.2021.05.19.10.56.31; Wed, 19 May 2021 10:56:44 -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=tl66YL0J; 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 S244714AbhERLbN (ORCPT + 99 others); Tue, 18 May 2021 07:31:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348223AbhERLbK (ORCPT ); Tue, 18 May 2021 07:31:10 -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 C13B5C06138B for ; Tue, 18 May 2021 04:29:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding: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=RVUhSCgd6iQAK0YSfHil0g0540QhJdzDOaZHYw4efBo=; b=tl66YL0JYskY6r9w4wyuz1msm 2nN5acglOY9mroY2uRDEigtHcNw/lxmbReo/GR0Wt8VyC5ni7zKmpRaOJLOCpfgK/dxHXOUIL5tCq aGcRVwrUs7lIyjwTfFnao1fs88QDm9YEdiHycchb9PR+GFUC1YH2UDApAY2ZT8SvG/z9PncAvC6Zp kZIL+XLsXuZroU2QD/0o93SjzghJ1ilf3PGOjpTy4b7OIhJYnRvzicYZQqZMJcjfL32lzzLH9ul/p otEiCDS+/fseB8D12RJcshFcL8vwUt2lQD8UdU5aY2WC3ZoQ7Ebs/yDoK5aYREWJ3OA6nFBvVCdEq QYEjvkmBw==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:44130) by pandora.armlinux.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lixuq-0004B6-8m; Tue, 18 May 2021 12:29:36 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1lixum-0007r3-6a; Tue, 18 May 2021 12:29:32 +0100 Date: Tue, 18 May 2021 12:29:32 +0100 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: Re: [PATCH] arm: make the size of vmalloc in cmdline and meminfo uniform Message-ID: <20210518112932.GV12395@shell.armlinux.org.uk> References: <20210518111254.3820480-1-yanfei.xu@windriver.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210518111254.3820480-1-yanfei.xu@windriver.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 18, 2021 at 07:12:54PM +0800, Yanfei Xu wrote: > 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. Hi, I think I'd like to do several cleanups with this: 1. change vmalloc_min to be an unsigned long. 2. exclude VMALLOC_OFFSET from vmalloc_min, moving it into adjust_lowmem_bounds where vmalloc_min is used. 3. rename vmalloc_min to be vmalloc_start 4. enforce vmalloc_start to be a multiple of 2MiB 5. in early_vmalloc(), calculate vmalloc_max as: VMALLOC_END - (PAGE_OFFSET + SZ_32M + VMALLOC_OFFSET) and use that to set the upper bound of vmalloc_reserve (which is something your patch doesn't do, which I think is a bug. Thoughts? > > Signed-off-by: Yanfei Xu > --- > 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 > -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!