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 2D110C4345F for ; Sat, 27 Apr 2024 08:50:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 683B06B0082; Sat, 27 Apr 2024 04:50:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 634366B0083; Sat, 27 Apr 2024 04:50:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4FB8B6B0085; Sat, 27 Apr 2024 04:50:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 32A486B0082 for ; Sat, 27 Apr 2024 04:50:32 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 896ABA0B00 for ; Sat, 27 Apr 2024 08:50:31 +0000 (UTC) X-FDA: 82054690662.24.52AE895 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 0D04F4000F for ; Sat, 27 Apr 2024 08:50:29 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rGoAfMZ5; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1714207830; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Fcpt3+YBftkSfwS4srMOfJhYTxwvIkbsPTMolQV4Brg=; b=61y5LdDUcHZKxHz4oTqJ7VLxusuGbLYbKBVMC1MHk3RahR5diWJmWrYFMnOIu0RhgEyB9I lkREIA9F38xInqJYzaPi2odvtHy2WrsBPPbEUd9T2Hyn+wtDXdNFbeKiC3wvzFgH/vNJ7Z yBYEvBkKAR2wjNTy/WqCPWvZDpQHRvY= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=rGoAfMZ5; spf=pass (imf12.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1714207830; a=rsa-sha256; cv=none; b=N9f2Nxne5KBGZO+YMkxiDaeszADFneBCtImteT2wgAiBBXE0Nk0M8FqoYeDL3HNbpx1nZO g5Re2yA3NCAlRemNp8+RWHGd9WjvSpR3Cd+0tVU+aKDJ2OSpyBYtmd7fQKegEuddtnDXYu PIs8V5fsWQadtECnje/mI8+aPzoxfh0= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id F3CE260B75; Sat, 27 Apr 2024 08:50:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9C8FC113CE; Sat, 27 Apr 2024 08:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714207828; bh=BuSVg2sIQz4rUwdjp1HPjb4SufNjrq2om93BcT+qtzg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rGoAfMZ57VcQEZ97fpBbcG+4RpLHAML9bNmDtpwcyadHjOAb3icpzNDVkwdRy49zs YXoxSKWHsqbiRYz96MbkBHuZRyXJQnu2g6GgOmFYPf1/1m8J4QywBx/uupsu7lXAo1 1fEeRl4PCJHjHanWu6BD7EjGWsoK8ZaVUwhh/VT12lbj1Rmd3shOkh8AmR3cqDnCry wn+miUXqUubLMNPl9c5mVDUx7Swx5wfvM4XcKfe10OOrwUARzz/q35o2P2My95v0qB l+brZsPmkYieLL2cBSoU7YRmRfgMKd6ZY2HIn/1WD681Gw0NlGRTsiSxUzBbsnu+ki Bg58ogmNj9GzA== Date: Sat, 27 Apr 2024 11:49:06 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Stat-Signature: 5dxjj4kb591g6ait5cpywygh64wt5thq X-Rspam-User: X-Rspamd-Queue-Id: 0D04F4000F X-Rspamd-Server: rspam05 X-HE-Tag: 1714207829-778475 X-HE-Meta: U2FsdGVkX19Vr476yGf+9fgtb+qn+18wkkk9l02QhyrWPCSfoz4fS33t37vLXRfjgohtFGot3K6MKN8RvBUm73AdRCa9/liNCLfwmifhulYAVsr215EYXZ5j/xz9KFmXb3QIG7At/wxVn/p9en5aobZXlLrXTkwQ9E2agXq0C1+fS+AOdhYIanrfTAzKxEM5yNY7VJy6d1gEoc28k6DRM7tgdo+UP3ktiy9dcV4HpjJ3a9qpU4hIKb9AvVcxy58mY5B7a39j52WHcR0OOOAOYi1GhpxGwOvUvIGG1SNE0P2L526lsonI3rjxBf6M0ZARg+wtGHbHd+vZyJm34rikIwDUg5dy/WUxsnRrtr0gO8J5yKvvEBhg0YoOn2V6SRwaeDg+Is4RoU4UUhJVRPahioBWs9THYS+ozYMX8A0SDj6L4MwCWxK5KNsZaZVhhSTe6k4Wam3V7NZsvVdPCjPpxu05lOni1YuDmh7MiT/uNi6+Z9W6tlQdJl2QRkadRCQ/bA6lOD1PrvIg8XFmIu0rs8E5ID/HCXGVGHdjmcC2c19exMrRrO6nphwCJs+w+kHRM4443/UXn5w0NVcpmJ6fhSHe/zTgIT7CdTs4o7PFv7/kXiXlrWAR7/M1cIXU392te0H+NFTs0PLC8QpA5NzJ3hzT0utnJoDRSa2ifmkLFikZVfLCWOq83pdPyasLgOmEfuuAvxBcwv7uIdOhB55OgUazLIzyjFz0z61pXeq/gASCOWKLL4tP2tfPSLn0RwD40NLtHYZypurF+gJV00wmeZADeTVlxsy30JmrTyD6ecmZzmgMdVone4tnc7gHAKGw3TSOLHXjLlYMfREQLwl5oecz9Cce3JDmQCGSy+5ikgw/V/Pfg+zYzxyoBZPGXb1q02QYq7/8kqY= 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: List-Subscribe: List-Unsubscribe: On Fri, Apr 19, 2024 at 10:59:52AM +0900, DaeRo Lee wrote: > 2024년 4월 19일 (금) 오전 10:46, DaeRo Lee 님이 작성: > > > > In memmap_init_reserved_pages, we mark memblock.reserved as > > PageReserved first and mark the memblock.reserved with nomap flag > > also. > Sorry. This is my mistake. 'memblock.memory with nomap flag' is right. > > > -> Isn't this duplicated work? (If we add no-map region to > > memblock.reserved 'and' mark in memblock.memory..) > > So, I think that for the no-map region, we don't need to add to the > > memblock.reserved. > > This is what we do now in early_init_dt_reserve_memory. the nomap > > region is not added to the memblock.reserved. > > > > In early_init_dt_alloc_reserved_memory_arch, if 'nomap' is true, we > > mark the memblock.memory region as _NOMAP. And if the return value > > 'err' is not zero(which is '-ENOMEM' from memblock_isolate_range), we > > free the region. > > - 'nomap' is true -> memblock_mark_nomap : success -> not free the region > > > > : fail -> free the region > > And it can be said that we add the region to the memblock.reserved > > using memblock_phys_alloc_range and if the region is nomap, then we > > can free the region from memblock.reserved. But is it necessary to add > > it to memblock.reserved? We just need the region in memblock.memory to > > mark nomap. > > > > So, here is what I think: > > - reserved-memory w/ nomap region -> mark only to memblock.memory > > - reserved-memory w/o nomap region -> add to the memblock.reserved NOMAP and memblock.reserved are semantically different, and at makes sense to have a "reserved nomap" node in fdt recorded in both memblock.memory and memblock.reserved. memblock.reserved represents the memory that is used by firmware or early kernel allocation, so reserved memory in fdt should be reserved in memblock as well. I believe it's an oversight that early_init_dt_reserve_memory() does not call memblock_reserve() for nomap memory. NOMAP is a property of a memory region that says that that region should not be mapped in the linear map, it's not necessarily in use. > > Regards, > > DaeRo Lee -- Sincerely yours, Mike.