Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1036539iob; Fri, 13 May 2022 20:33:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVUpXdJFZmXGMYhnlAn/U2kVoGkDJ9KxF/SKt3syK5pGFN6/qgsasYfFu81qcoWLcTHBlN X-Received: by 2002:a5d:4344:0:b0:20c:cad4:9e9b with SMTP id u4-20020a5d4344000000b0020ccad49e9bmr6047298wrr.187.1652499187272; Fri, 13 May 2022 20:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652499187; cv=none; d=google.com; s=arc-20160816; b=Ml+Bqx3eyAoihLNaIktNwrW2cDHYegf3mEki+MyXHsF4fSqOTYp05ODKSiUhEHzi9Z QUYEMY+idlkpZereXR72cDS5eMGc/Or6HmpNswTsKTPov46X2EG7vdhPqmptb2IFgY8n 9hpZ8ccqQQYxetgz1Qq4m0pYPhRUdv+d1HS7ce906V7g4Pi2F0OnjQ30lRewPvenf9yA THzl5knNlWfWdDhebdmnL9s+YYIISkXNicnnlWw9/uGfW245+kMdzCQ6dZP5bQqL3iHk q3XgFwQVEVsUQD4aWzCDN569+CEoQprLTyY5ie8srdCHrcjSqxqcrq33sOBMCvhZFrR4 2a1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=RcSXShzpbLQ7DrUBhWjjcx/UiyqAKV/aMJsqg/yFGOE=; b=tDhE3wKNZxOcbeVS8niIewe515n1j5N+sv674sqzBV6i90gTYSU9Cv7bg/Lk3blrpF JNxTDW/7FAMdEwU0IxlPfdLW4APAT20kuSWr3WSomDTohkPlP025Htfs406/ycdkMtEf mpKsOoWIX7E9/PRWgky/SF4y7nhQGOi+n+s04vXg9DTe2PcaqCVXUcw/EsynOrrVWkbp aLkTxZI5JtgiftRINakidRC1vUjZFDhCpj6EshPq+MTowkRTk7xNTZY33Fxp2YYDh7wR 9/VGu3BOEWzSTXHEdf6hould+BvE0gDIW7iIMZ4AlHzhH/j1lFGBJ/EUXIRjQxmaJ6/Q Qo4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t1MJpFJh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d7-20020adfe847000000b0020cdded70efsi3245798wrn.864.2022.05.13.20.33.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:33:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=t1MJpFJh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A02CA431292; Fri, 13 May 2022 17:09:28 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350332AbiELG24 (ORCPT + 99 others); Thu, 12 May 2022 02:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350207AbiELG2z (ORCPT ); Thu, 12 May 2022 02:28:55 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09AC8185CB5 for ; Wed, 11 May 2022 23:28:53 -0700 (PDT) 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 sin.source.kernel.org (Postfix) with ESMTPS id 53D17CE2811 for ; Thu, 12 May 2022 06:28:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98F90C385B8; Thu, 12 May 2022 06:28:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652336930; bh=86ZkoUSlcv+cLdSEqCEOYta5lwjJpAX090c8eXe4Ytw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=t1MJpFJhUtfs+gP2fnP+9UIPJVJ9U3Qo8C96iGR+M5DH6AhIXKlDZYafTYqttPw4p cnYtjAmNEq9dwXyfHgdpd5/26eCbndIfoCqUdq+xxqpFqLpT6i6tzkfpeqrloePNbP 0U6dh8l/JIGEb+gQv/UZCaG4F63M/p2LASAYK2NDrHlQgzfvLsaypf8vlhuREE7AnS p84q9bMHCvTDWRdzn4s1yLdHNLIBaN9r8CxeMAr3q+fUXuTqLWbGyQEjtHyExRMB1H DUaycNkNlRetVXRZfEKr5QjCC6yqUMdUtWBq6ncbgf6NymEW4g/o+PmOEAfPcGjDpp dfY1ohLwEl/UQ== Date: Thu, 12 May 2022 09:28:42 +0300 From: Mike Rapoport To: "Zhouguanghui (OS Kernel)" Cc: Andrew Morton , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "xuqiang (M)" Subject: Re: [PATCH] memblock: config the number of init memblock regions Message-ID: References: <20220511010530.60962-1-zhouguanghui1@huawei.com> <20220510185523.3f7479b8ffc49a8a7c17d328@linux-foundation.org> <73da782c847b413d9b81b0c2940ab13c@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <73da782c847b413d9b81b0c2940ab13c@huawei.com> X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 12, 2022 at 02:46:25AM +0000, Zhouguanghui (OS Kernel) wrote: > 在 2022/5/11 14:03, Mike Rapoport 写道: > > On Tue, May 10, 2022 at 06:55:23PM -0700, Andrew Morton wrote: > >> 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. > > > > I'd like to see more details about how firmware creates that sparse memory > > map in the changelog. > > > > The scenario is as follows: In a system using HBM, a multi-bit ECC error > occurs, and the BIOS saves the corresponding area (for example, 2 MB). > When the system restarts next time, these areas are isolated and not > reported or reported as EFI_UNUSABLE_MEMORY. Both of them lead to an > increase in the number of memblocks, whereas EFI_UNUSABLE_MEMORY leads > to a larger number of memblocks. > > For example, if the EFI_UNUSABLE_MEMORY type is reported: > ... > memory[0x92] [0x0000200834a00000-0x0000200835bfffff], 0x0000000001200000 bytes on node 7 flags: 0x0 > memory[0x93] [0x0000200835c00000-0x0000200835dfffff], 0x0000000000200000 bytes on node 7 flags: 0x4 > memory[0x94] [0x0000200835e00000-0x00002008367fffff], 0x0000000000a00000 bytes on node 7 flags: 0x0 > memory[0x95] [0x0000200836800000-0x00002008369fffff], 0x0000000000200000 bytes on node 7 flags: 0x4 > memory[0x96] [0x0000200836a00000-0x0000200837bfffff], 0x0000000001200000 bytes on node 7 flags: 0x0 > memory[0x97] [0x0000200837c00000-0x0000200837dfffff], 0x0000000000200000 bytes on node 7 flags: 0x4 > memory[0x98] [0x0000200837e00000-0x000020087fffffff], 0x0000000048200000 bytes on node 7 flags: 0x0 > memory[0x99] [0x0000200880000000-0x0000200bcfffffff], 0x0000000350000000 bytes on node 6 flags: 0x0 > memory[0x9a] [0x0000200bd0000000-0x0000200bd01fffff], 0x0000000000200000 bytes on node 6 flags: 0x4 > memory[0x9b] [0x0000200bd0200000-0x0000200bd07fffff], 0x0000000000600000 bytes on node 6 flags: 0x0 > memory[0x9c] [0x0000200bd0800000-0x0000200bd09fffff], 0x0000000000200000 bytes on node 6 flags: 0x4 > memory[0x9d] [0x0000200bd0a00000-0x0000200fcfffffff], 0x00000003ff600000 bytes on node 6 flags: 0x0 > memory[0x9e] [0x0000200fd0000000-0x0000200fd01fffff], 0x0000000000200000 bytes on node 6 flags: 0x4 > memory[0x9f] [0x0000200fd0200000-0x0000200fffffffff], 0x000000002fe00000 bytes on node 6 flags: 0x0 > ... Thanks for the clarification of the usecase. > >>> > >>> ... > >>> > >> > >> 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. > > > > 60k is not big, but using 1024 entries array for 2-4 memory banks on > > systems that don't report that fragmented memory map is really a waste. > > > > We can make this per platform opt-in, like INIT_MEMBLOCK_RESERVED_REGIONS ... > > > > As I described above, is this a general scenario? The EFI memory on arm64 is generally bad because of all those NOMAP carveouts spread all over the place even in cases without memory faults. So it would make sense to increase the number of memblock regions on arm64 when CONFIG_EFI=y. > >> Or zero if CONFIG_ARCH_KEEP_MEMBLOCK and CONFIG_MEMORY_HOTPLUG > >> are cooperating. > > > > ... or add code that will discard unused parts of memblock arrays even if > > CONFIG_ARCH_KEEP_MEMBLOCK=y. > > > > In scenarios where the memory usage is sensitive, should > CONFIG_ARCH_KEEP_MEMBLOCK be set to n or set the number by adding config? We are talking about 20 or so architectures that are doing well with 128 memblock regions. I don't see why they need to be altered to accommodate this use-case. > Andrew, Mike, thank you. -- Sincerely yours, Mike.