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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BAB3C433FE for ; Sun, 26 Dec 2021 08:33:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9FD386B0078; Sun, 26 Dec 2021 03:33:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9AD486B007B; Sun, 26 Dec 2021 03:33:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C2F26B0080; Sun, 26 Dec 2021 03:33:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0097.hostedemail.com [216.40.44.97]) by kanga.kvack.org (Postfix) with ESMTP id 7AFC06B0078 for ; Sun, 26 Dec 2021 03:33:52 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 2BFFE894DB for ; Sun, 26 Dec 2021 08:33:52 +0000 (UTC) X-FDA: 78959282304.10.C63EAE3 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf30.hostedemail.com (Postfix) with ESMTP id 1A55C80051 for ; Sun, 26 Dec 2021 08:33:50 +0000 (UTC) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4JMDb55RtDzbjYq; Sun, 26 Dec 2021 16:33:21 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Sun, 26 Dec 2021 16:33:48 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.20; Sun, 26 Dec 2021 16:33:47 +0800 Message-ID: <60dd4235-865b-6072-d44c-5c50f4683ab4@huawei.com> Date: Sun, 26 Dec 2021 16:33:46 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH 1/3] mm: vmalloc: Let user to control huge vmalloc default behavior Content-Language: en-US To: Jonathan Corbet , Andrew Morton , , , , , , CC: Nicholas Piggin , Catalin Marinas , Will Deacon , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Michael Ellerman , "Benjamin Herrenschmidt" , Paul Mackerras References: <20211226083912.166512-1-wangkefeng.wang@huawei.com> <20211226083912.166512-2-wangkefeng.wang@huawei.com> From: Kefeng Wang In-Reply-To: <20211226083912.166512-2-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggeme710-chm.china.huawei.com (10.1.199.106) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1A55C80051 X-Stat-Signature: ng1gmekmzessi6ywy75jkxd6y5heizjr Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf30.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com X-HE-Tag: 1640507630-292638 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2021/12/26 16:39, Kefeng Wang wrote: > Add HUGE_VMALLOC_DEFAULT_ENABLED to let user to choose whether or > not enable huge vmalloc mappings by default, and this could make > more architectures to enable huge vmalloc mappings feature but > don't want to enable it by default. > > Add hugevmalloc=3Don/off parameter to enable or disable this feature > at boot time, nohugevmalloc is still supported and equivalent to > hugevmalloc=3Doff. > > Signed-off-by: Kefeng Wang > --- > .../admin-guide/kernel-parameters.txt | 12 ++++++++++++ > arch/powerpc/Kconfig | 1 + > mm/Kconfig | 7 +++++++ > mm/vmalloc.c | 18 +++++++++++++++++= - > 4 files changed, 37 insertions(+), 1 deletion(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Document= ation/admin-guide/kernel-parameters.txt > index 2fba82431efb..4107136097a6 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -1629,6 +1629,18 @@ > If both parameters are enabled, hugetlb_free_vmemmap takes > precedence over memory_hotplug.memmap_on_memory. > =20 > + > + hugevmalloc=3D [PPC] Reguires CONFIG_HAVE_ARCH_HUGE_VMALLOC > + Format: { on | off } > + Default set by CONFIG_HUGE_VMALLOC_DEFAULT_ENABLED. > + > + This parameter enables/disables kernel huge vmalloc > + mappings at boot time. > + > + on: Enable the feature > + off: Disable the feature > + Equivalent to: nohugevmalloc > + > hung_task_panic=3D > [KNL] Should the hung task detector generate panics. > Format: 0 | 1 > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig > index dea74d7717c0..d59b221be264 100644 > --- a/arch/powerpc/Kconfig > +++ b/arch/powerpc/Kconfig > @@ -246,6 +246,7 @@ config PPC > select HAVE_STATIC_CALL if PPC32 > select HAVE_SYSCALL_TRACEPOINTS > select HAVE_VIRT_CPU_ACCOUNTING > + select HUGE_VMALLOC_DEFAULT_ENABLED if HAVE_ARCH_HUGE_VMALLOC > select HUGETLB_PAGE_SIZE_VARIABLE if PPC_BOOK3S_64 && HUGETLB_PAGE > select IOMMU_HELPER if PPC64 > select IRQ_DOMAIN > diff --git a/mm/Kconfig b/mm/Kconfig > index 356f4f2c779e..4ba91c0359bd 100644 > --- a/mm/Kconfig > +++ b/mm/Kconfig > @@ -262,6 +262,13 @@ config HUGETLB_PAGE_SIZE_VARIABLE > HUGETLB_PAGE_ORDER when there are multiple HugeTLB page sizes avai= lable > on a platform. > =20 > +config HUGE_VMALLOC_DEFAULT_ENABLED > + bool "Enable huge vmalloc mappings by default" > + depends on HAVE_ARCH_HUGE_VMALLOC > + help > + Enable huge vmalloc mappings by default, this value could be overri= dden > + by hugevmalloc=3Doff|on. > + > config CONTIG_ALLOC > def_bool (MEMORY_ISOLATION && COMPACTION) || CMA > =20 > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > index d2a00ad4e1dd..3b6f99753816 100644 > --- a/mm/vmalloc.c > +++ b/mm/vmalloc.c > @@ -58,7 +58,7 @@ static const unsigned int ioremap_max_page_shift =3D = PAGE_SHIFT; > #endif /* CONFIG_HAVE_ARCH_HUGE_VMAP */ > =20 > #ifdef CONFIG_HAVE_ARCH_HUGE_VMALLOC > -static bool __ro_after_init vmap_allow_huge =3D true; > +static bool __ro_after_init vmap_allow_huge =3D IS_ENABLED(CONFIG_HUGE= _VMALLOC_DEFAULT_ENABLED); > =20 > static int __init set_nohugevmalloc(char *str) > { > @@ -66,6 +66,22 @@ static int __init set_nohugevmalloc(char *str) > return 0; > } > early_param("nohugevmalloc", set_nohugevmalloc); > + > +static int __init set_hugevmalloc(char *str) > +{ > + if (!str) > + return -EINVAL; > + > + if (!strcmp(str, "on")) > + vmap_allow_huge =3D true; > + else if (!strcmp(str, "off")) > + vmap_allow_huge =3D true; should=C2=A0vmap_allow_huge=3Dfalse, my mistake... > + else > + return -EINVAL; > + > + return 0; > +} > +early_param("hugevmalloc=3D", set_hugevmalloc); > #else /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */ > static const bool vmap_allow_huge =3D false; > #endif /* CONFIG_HAVE_ARCH_HUGE_VMALLOC */