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 B3D4BC433F5 for ; Wed, 11 May 2022 01:55:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 21A6E6B0071; Tue, 10 May 2022 21:55:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1C8406B0072; Tue, 10 May 2022 21:55:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 091AE6B0073; Tue, 10 May 2022 21:55:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EEC426B0071 for ; Tue, 10 May 2022 21:55:26 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A09E621D35 for ; Wed, 11 May 2022 01:55:26 +0000 (UTC) X-FDA: 79451795052.12.53A3851 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf22.hostedemail.com (Postfix) with ESMTP id 64BF1C00A2 for ; Wed, 11 May 2022 01:55:24 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 509CC61316; Wed, 11 May 2022 01:55:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84DF5C385D4; Wed, 11 May 2022 01:55:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1652234124; bh=RtSdZCnq9Vk4zc1XyJ8ZqHXdTm5EZ4CK1h6O7cMw0pI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=J79FLtB90hPRhj8Cyxnz5KUi42r/kNxFA3LWVSJAnnlxqXpoUmGvDgWXk+sf9663p gacki1T30wP6yYsIoiz1GisRrMHjZKKFd7Y8FZf29HErhWaUq9kBMSh9AYY+lbXYL2 Hht6B3dw/xl2srLlkSdSQLev8e9GAfHBVPItXmn0= Date: Tue, 10 May 2022 18:55:23 -0700 From: Andrew Morton To: Zhou Guanghui Cc: , , , Subject: Re: [PATCH] memblock: config the number of init memblock regions Message-Id: <20220510185523.3f7479b8ffc49a8a7c17d328@linux-foundation.org> In-Reply-To: <20220511010530.60962-1-zhouguanghui1@huawei.com> References: <20220511010530.60962-1-zhouguanghui1@huawei.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 64BF1C00A2 X-Stat-Signature: exsgiotqs6asgijf366xgiqwri6uwg56 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=J79FLtB9; spf=pass (imf22.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam09 X-HE-Tag: 1652234124-866497 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 Wed, 11 May 2022 01:05:30 +0000 Zhou Guanghui wrote: > During early boot, the number of memblocks may exceed 128(some memory > areas are not reported to the kernel due to test failures. As a result, > contiguous memory is divided into multiple parts for reporting). If > the size of the init memblock regions is exceeded before the array size > can be resized, the excess memory will be lost. > > ... > > --- a/mm/Kconfig > +++ b/mm/Kconfig > @@ -89,6 +89,14 @@ config SPARSEMEM_VMEMMAP > pfn_to_page and page_to_pfn operations. This is the most > efficient option when sufficient kernel resources are available. > > +config MEMBLOCK_INIT_REGIONS > + int "Number of init memblock regions" > + range 128 1024 > + default 128 > + help > + The number of init memblock regions which used to track "memory" and > + "reserved" memblocks during early boot. > + > config HAVE_MEMBLOCK_PHYS_MAP > bool > > diff --git a/mm/memblock.c b/mm/memblock.c > index e4f03a6e8e56..6893d26b750e 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -22,7 +22,7 @@ > > #include "internal.h" > > -#define INIT_MEMBLOCK_REGIONS 128 > +#define INIT_MEMBLOCK_REGIONS CONFIG_MEMBLOCK_INIT_REGIONS Consistent naming would be nice - MEMBLOCK_INIT versus INIT_MEMBLOCK. Can we simply increase INIT_MEMBLOCK_REGIONS to 1024 and avoid the config option? It appears that the overhead from this would be 60kB or so. Or zero if CONFIG_ARCH_KEEP_MEMBLOCK and CONFIG_MEMORY_HOTPLUG are cooperating.