Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp160442lqt; Thu, 18 Apr 2024 11:04:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUNsSjwyr9nXbys3Dj9+EpYM9jyWj1D/psYzK52BV1Rg2K8wF1ezFCdlcVJ6rtkU1iZdKDwyBcS+ITapWIJqyU1UVc30H3EoM9Wl1qEw== X-Google-Smtp-Source: AGHT+IHyRHOOzSm4HfM97QIpjGuOCP2xVO/Q4Pi4VSdfA8hvhgu/H/UpZq5XCg1mLXWj8T1wSV+q X-Received: by 2002:a9d:6759:0:b0:6ea:2789:8b62 with SMTP id w25-20020a9d6759000000b006ea27898b62mr4486269otm.19.1713463470917; Thu, 18 Apr 2024 11:04:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713463470; cv=pass; d=google.com; s=arc-20160816; b=0nttY0MvFlaOuhz2z8TmyY1Sq6A0uFcPgxslooGh4RK9hdGYQ8VNQNKVahCF4ggB2W vqC+Uw5HlWoAL0u71eiIJcMrlYrGYpJjxRzzu/bLu0mq1bgAU8OnWmKyHJGp26CD8LbW R4C1LFZI389KXZkG4wVaAwO46p4DBXbCvaZQ9CduV1lKNSOrSvkK3GWqxb2Wv96gO3hB m4Wh1oWEod6MQeboG4Hk8aqK8XaCrd+52igWl2ObGum4hEvaYzmt3NTVwF20l+O1Kt2r YUuiQ0MaMX2Clt+SBUWgjH4eBKD4hQNzaQWH02DTq6sISYODQ0Nsj6TDXhFni5+abZ40 GWhg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=63SuhRdoff74BSJ7YarXv5u7BNPdSHKxJ853aB2r/Uk=; fh=dCmvRD8QZ+oB4zwFLVkiv3/Bm/R8FGsEQ2nLZVNz7Lk=; b=tmjBD0EMuRua6lc3IzqUrgRInRTZYlrhSaavldl6fBiDoqwVC5IQkpJbXfH6uzxe69 TPzx9fxHPV8E1oCbUNsQblee77mOfQiY5l8PC/JTVujbTaHEwSdLIa90mdjxZjDuSgV5 EUozruY/aBZ+YmosXrFINOBSPBFGgBrtk1dykgj+ITSEm5q8luAhae8q4UYUjyFGNtaQ ymXNPNk/Qn4yWbKeq7k9l3C1LSNwiFhQlVS/mzcOa5wlyNhqZgzRipR+s/EMyazeobP3 HwvyrZuHRXP0pDu58b+U30hKcpb4VlJ6+7xuQxcyIYs3GCfY6nknv43yJs4yOR3vieLP 1G7Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vhz9MLtW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-150609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150609-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f11-20020a67fd0b000000b0047ba55d2febsi331362vsr.186.2024.04.18.11.04.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 11:04:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Vhz9MLtW; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-150609-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150609-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9696E1C2105C for ; Thu, 18 Apr 2024 18:04:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ED1B3178CFA; Thu, 18 Apr 2024 18:04:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Vhz9MLtW" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D0B7177983; Thu, 18 Apr 2024 18:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713463463; cv=none; b=tZ3HcfizcaLtqk8SkuR0kMJ/sTQxrBqjtDhJRAV3qhE6kSTvM5bDb3JFnS/7dVuTpbveeFun6OeBEYfY9Vof0BHsSoIKq9QhyMeznib3Y8zEtLoWoWT0Pr6EwhRqDTpkoPI1OweFXm5J3ZZUvmuiheORzqsC31CsdwNn5pgW2TU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713463463; c=relaxed/simple; bh=lLVjAlxxr1hI4YSIYnF75PDevgYd6I1NnS5Ce2xKYes=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BTczuUjxwNhBF08oDh+ngh26D9EaD5gCAoPnr+ChLxJp2eKgncvJhnGtsuMSpwfswOncwWUIWtEPJ80BB+d7rnUAXBSNJWG5zotDGlfX469PDOxgWPysIunOdOn1y/i6oSsp0+YfOzh082SjYnttDS2mwb0EsNrnpOh61/lNaHA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vhz9MLtW; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E349CC116B1; Thu, 18 Apr 2024 18:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713463462; bh=lLVjAlxxr1hI4YSIYnF75PDevgYd6I1NnS5Ce2xKYes=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Vhz9MLtWWmXiJyfJszBrF18JGNnetf7ZJj0t4W6UqAPasYEGuGGb1NPN4GCrtPTkU CD9VK/B27CWo34P8LE7C1z7citVmlQ/6bnZ21c/+i9isgm1MEDJNID4bFFuu9BqDgt 9mau9Yu+u9jF8BZhNbYsX6AUS7HR6A7YPlEKGKMQlcL1uIZTXnwbJEpW3O9g2tOs0N s9NFsrNx7ObhjcXPghnotyVevIp9XnlJULFAYVa4LmAK1ESsPJUBhBb1UC6pGqBWea 7iniKU7Dr0kzIlv5EIx3PsjrMuHNb2lc2t5jS8ocYzbL5idf4UrK9bIJErvamLFxN1 0Yk5Zf1hBBKMw== Date: Thu, 18 Apr 2024 21:03:13 +0300 From: Mike Rapoport To: DaeRo Lee Cc: robh@kernel.org, saravanak@google.com, akpm@linux-foundation.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Daero Lee Subject: Re: [PATCH v2] memblock: add no-map alloc functions Message-ID: References: <20240416120635.361838-1-skseofh@gmail.com> <20240416120635.361838-2-skseofh@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Thu, Apr 18, 2024 at 11:54:15PM +0900, DaeRo Lee wrote: > 2024년 4월 17일 (수) 오후 3:03, Mike Rapoport 님이 작성: > > > > On Tue, Apr 16, 2024 at 09:06:35PM +0900, skseofh@gmail.com wrote: > > > From: Daero Lee > > > > > > Like reserved-memory with the 'no-map' property and only 'size' property > > > (w/o 'reg' property), there are memory regions need to be allocated in > > > memblock.memory marked with the MEMBLOCK_NOMAP flag, but should not be > > > allocated in memblock.reserved. > > > > This still does not explain why you need such regions. > > > > As Wei Yang explained, memblock does not allocate memory from > > memblock.reserved. The memblock.reserved array represents memory that is in > > use by firmware or by early kernel allocations and cannot be freed to page > > allocator. > Thank you for your comments. I used the wrong word. > When I use 'allocate', I mean that the region 'adds' to the memblock.reserved. > > > > > If you have a region that's _NOMAP in memblock.memory and is absent in > > memblock.reserved it will not be mapped by the kernel page tables, but it > > will be considered as free memory by the core mm. > > > > Is this really what you want? > If my understanding is right, before freeing (memory && !reserved) > area, we marked the memblock.reserved regions and memblock.memory > regions with no-map flag. And when we free (memory && !reserved) area, > we skip the memblock.memory regions with no-map(see > should_skip_region). So, I think that the memory regions with no-map > flag will not be considered as free memory. You are right here. But I still don't understand *why* do you want to change the way early_init_dt_alloc_reserved_memory_arch() works. > Regards, > DaeRo Lee -- Sincerely yours, Mike.