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 AA1D6C433EF for ; Thu, 5 May 2022 16:54:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9B3786B0071; Thu, 5 May 2022 12:54:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 960EB6B0073; Thu, 5 May 2022 12:54:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82B656B0074; Thu, 5 May 2022 12:54:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 754EC6B0071 for ; Thu, 5 May 2022 12:54:09 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 505C760958 for ; Thu, 5 May 2022 16:54:09 +0000 (UTC) X-FDA: 79432287018.04.0D56144 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf16.hostedemail.com (Postfix) with ESMTP id 0F6971800A0 for ; Thu, 5 May 2022 16:54:01 +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 ams.source.kernel.org (Postfix) with ESMTPS id 53E20B82C77; Thu, 5 May 2022 16:54:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6051C385A4; Thu, 5 May 2022 16:54:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651769646; bh=p+Bv32mI3hSoH46S0grONiKmXRZCUz+77zQaW/pFQpI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ge893G0ricbEaTvms2L5/YKhHTsgFuJ/7NLqXN3SX8NpXoG2SV4/QAnKg1fa109xu k7OgZmCSKyvaWwnM3hHRoJ7fcDiiDzSqvYkeAQPgZqW9PoY6NESDTdv+bgwuPCaE6R 2c3iK+pMen4QnzLomiBDyIhvf+zfmylWCC7WvWpZC5MYR7MkJ47Xn8s42+jHPDU2Ar 3Vn2VIByNoahv8T79eZxtwcpkmm4bl0dxt6r/UIY/LwKtlSJ/LKOOlpIewpoxoR5un jdfKjFww+mxhzHURhRk8F2TWG51rnNI922vQ/Y5tjFIgC5eeeBLRfY+wMN/sFcMtTH oxd028ySdMxMw== Date: Thu, 5 May 2022 09:54:00 -0700 From: Mike Rapoport To: Faiyaz Mohammed Cc: quic_vjitta@quicinc.com, karahmed@amazon.de, qperret@google.com, robh@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, robh+dt@kernel.org, frowand.list@gmail.com, devicetree@vger.kernel.org Subject: Re: [PATCH] mm: memblock: avoid to create memmap for memblock nomap regions Message-ID: References: <1649704172-13181-1-git-send-email-quic_faiyazm@quicinc.com> <7b18bea8-b996-601d-f490-cb8aadfffa1b@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7b18bea8-b996-601d-f490-cb8aadfffa1b@quicinc.com> X-Rspamd-Queue-Id: 0F6971800A0 X-Stat-Signature: whaikhyoi6bm7zuyfqouaqaigp6qhzsg Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=ge893G0r; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf16.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1651769641-824714 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 Thu, May 05, 2022 at 08:46:15PM +0530, Faiyaz Mohammed wrote: > > On 4/12/2022 10:56 PM, Mike Rapoport wrote: > > On Tue, Apr 12, 2022 at 12:39:32AM +0530, Faiyaz Mohammed wrote: > >> This 'commit 86588296acbf ("fdt: Properly handle "no-map" field in the > >> memory region")' is keeping the no-map regions in memblock.memory with > >> MEMBLOCK_NOMAP flag set to use no-map memory for EFI using memblock api's, > >> but during the initialization sparse_init mark all memblock.memory as > >> present using for_each_mem_pfn_range, which is creating the memmap for > >> no-map memblock regions. To avoid it skiping the memblock.memory regions > >> set with MEMBLOCK_NOMAP set and with this change we will be able to save > >> ~11MB memory for ~612MB carve out. > > The MEMBLOCK_NOMAP is very fragile and caused a lot of issues already. I > > really don't like the idea if adding more implicit assumptions about how > > NOMAP memory may or may not be used in a generic iterator function. > > Sorry for delayed response. > Yes, it is possible that implicit assumption can create > misunderstanding. How about adding command line option and control the > no-map region in fdt.c driver, to decide whether to keep "no-map" region > with NOMAP flag or remove?. Something like below I really don't like memblock_remove() for such cases. Pretending there is a hole when there is an actual DRAM makes things really hairy when it comes to memory map and page allocator initialization. You wouldn't want to trade system stability and random memory corruptions for 11M of "saved" memory. > --- a/drivers/of/fdt.c > +++ b/drivers/of/fdt.c > @@ -1180,8 +1180,10 @@ int __init __weak > early_init_dt_reserve_memory_arch(phys_addr_t base, >                  */ >                 if (memblock_is_region_reserved(base, size)) >                         return -EBUSY; > - > -               return memblock_mark_nomap(base, size); > +               if (remove_nomap_region) > +                       return memblock_remove(base, size); > +               else > +                       return memblock_mark_nomap(base, size); > Thanks and regards, > Mohammed Faiyaz > -- Sincerely yours, Mike.