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.5 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,URIBL_BLOCKED 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 2C322C433EF for ; Fri, 17 Sep 2021 07:04:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D242861130 for ; Fri, 17 Sep 2021 07:04:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D242861130 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 711586B0072; Fri, 17 Sep 2021 03:04:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 698B7900002; Fri, 17 Sep 2021 03:04:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 588266B0074; Fri, 17 Sep 2021 03:04:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 49E2B6B0072 for ; Fri, 17 Sep 2021 03:04:09 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F42311837CD8C for ; Fri, 17 Sep 2021 07:04:08 +0000 (UTC) X-FDA: 78596176218.05.B85232E Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf05.hostedemail.com (Postfix) with ESMTP id 99BFF505B6D0 for ; Fri, 17 Sep 2021 07:04:08 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D7C760ED7; Fri, 17 Sep 2021 07:04:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631862247; bh=403SancS4CQvO5c2rJiMT2tVA4Yjat2UeGGYmKH0yTY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m83sWZkyZmPJg1VJ4sBO68BtR7/7Af/G9JOYbCpT+C3N2kRaxOC4w9CRxrbHzgE2h 3LmrT4PUTCHM9w8Htcya0UZjxC3Xvo45EtAnaU9Hb2FshLfOMEsvrEQLDtC4/2tb5D /KTwJPDfOW60tLh4DxBCombhVx+7czSxk/NW+25E= Date: Fri, 17 Sep 2021 09:04:04 +0200 From: Greg KH To: Kefeng Wang Cc: will@kernel.org, catalin.marinas@arm.com, ryabinin.a.a@gmail.com, andreyknvl@gmail.com, dvyukov@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, elver@google.com, akpm@linux-foundation.org, kasan-dev@googlegroups.com Subject: Re: [PATCH v4 2/3] arm64: Support page mapping percpu first chunk allocator Message-ID: References: <20210910053354.26721-1-wangkefeng.wang@huawei.com> <20210910053354.26721-3-wangkefeng.wang@huawei.com> <9b2e89c4-a821-8657-0ffb-d822aa51936c@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <9b2e89c4-a821-8657-0ffb-d822aa51936c@huawei.com> X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 99BFF505B6D0 Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linuxfoundation.org header.s=korg header.b=m83sWZky; dmarc=pass (policy=none) header.from=linuxfoundation.org; spf=pass (imf05.hostedemail.com: domain of gregkh@linuxfoundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org X-Stat-Signature: f7n1dfhmbn81qoe7yyh6xpcy8t6bf6c8 X-HE-Tag: 1631862248-556602 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 Fri, Sep 17, 2021 at 02:55:18PM +0800, Kefeng Wang wrote: >=20 > On 2021/9/17 14:24, Greg KH wrote: > > On Fri, Sep 10, 2021 at 01:33:53PM +0800, Kefeng Wang wrote: > > > Percpu embedded first chunk allocator is the firstly option, but it > > > could fails on ARM64, eg, > > > "percpu: max_distance=3D0x5fcfdc640000 too large for vmalloc spa= ce 0x781fefff0000" > > > "percpu: max_distance=3D0x600000540000 too large for vmalloc spa= ce 0x7dffb7ff0000" > > > "percpu: max_distance=3D0x5fff9adb0000 too large for vmalloc spa= ce 0x5dffb7ff0000" > > > then we could meet "WARNING: CPU: 15 PID: 461 at vmalloc.c:3087 pcp= u_get_vm_areas+0x488/0x838", > > > even the system could not boot successfully. > > >=20 > > > Let's implement page mapping percpu first chunk allocator as a fall= back > > > to the embedding allocator to increase the robustness of the system= . > > >=20 > > > Reviewed-by: Catalin Marinas > > > Signed-off-by: Kefeng Wang > > > --- > > > arch/arm64/Kconfig | 4 ++ > > > drivers/base/arch_numa.c | 82 +++++++++++++++++++++++++++++++++++= ----- > > > 2 files changed, 76 insertions(+), 10 deletions(-) > > >=20 > > > diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig > > > index 077f2ec4eeb2..04cfe1b4e98b 100644 > > > --- a/arch/arm64/Kconfig > > > +++ b/arch/arm64/Kconfig > > > @@ -1042,6 +1042,10 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK > > > def_bool y > > > depends on NUMA > > > +config NEED_PER_CPU_PAGE_FIRST_CHUNK > > > + def_bool y > > > + depends on NUMA > > Why is this a config option at all? >=20 > The config is introduced from >=20 > commit 08fc45806103e59a37418e84719b878f9bb32540 > Author: Tejun Heo > Date:=A0=A0 Fri Aug 14 15:00:49 2009 +0900 >=20 > =A0=A0=A0 percpu: build first chunk allocators selectively >=20 > =A0=A0=A0 There's no need to build unused first chunk allocators in. De= fine > =A0=A0=A0 CONFIG_NEED_PER_CPU_*_FIRST_CHUNK and let archs enable them > =A0=A0=A0 selectively. >=20 > For now, there are three ARCHs support both PER_CPU_EMBED_FIRST_CHUNK >=20 > and PER_CPU_PAGE_FIRST_CHUNK. >=20 > =A0 arch/powerpc/Kconfig:config NEED_PER_CPU_PAGE_FIRST_CHUNK > =A0 arch/sparc/Kconfig:config NEED_PER_CPU_PAGE_FIRST_CHUNK > =A0 arch/x86/Kconfig:config NEED_PER_CPU_PAGE_FIRST_CHUNK >=20 > and we have a cmdline to choose a alloctor. >=20 > =A0=A0 percpu_alloc=3D=A0=A0 Select which percpu first chunk allocator = to use. > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Currently suppor= ted values are "embed" and "page". > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 Archs may suppor= t subset or none of the selections. > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 See comments in = mm/percpu.c for details on each > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 allocator.=A0 Th= is parameter is primarily for debugging > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 and performance = comparison. >=20 > embed percpu first chunk allocator is the first choice, but it could fa= ils > due to some >=20 > memory layout(it does occurs on ARM64 too.), so page mapping percpu fir= st > chunk >=20 > allocator is as a fallback, that is what this patch does. >=20 > >=20 > > > + > > > source "kernel/Kconfig.hz" > > > config ARCH_SPARSEMEM_ENABLE > > > diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c > > > index 46c503486e96..995dca9f3254 100644 > > > --- a/drivers/base/arch_numa.c > > > +++ b/drivers/base/arch_numa.c > > > @@ -14,6 +14,7 @@ > > > #include > > > #include > > > +#include > > > struct pglist_data *node_data[MAX_NUMNODES] __read_mostly; > > > EXPORT_SYMBOL(node_data); > > > @@ -168,22 +169,83 @@ static void __init pcpu_fc_free(void *ptr, si= ze_t size) > > > memblock_free_early(__pa(ptr), size); > > > } > > > +#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK > > Ick, no #ifdef in .c files if at all possible please. >=20 > The drivers/base/arch_numa.c is shared by RISCV/ARM64, so I add this co= nfig > to >=20 > no need to build this part on RISCV. Ok, then you need to get reviews from the mm people as I know nothing about this at all, sorry. This file ended up in drivers/base/ for some reason to make it easier for others to use cross-arches, not that it had much to do with the driver core :( thanks, greg k-h