From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E01FA2264A8 for ; Fri, 22 May 2026 00:48:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779410919; cv=none; b=BjSMKLeb7A0j5SEM2IIhwvFxMvWkjAmDevMLHs5iukZIcXNgC36+oWgKpmbMXJdlxNSqURPVY9SbCjIXsliltvu6Ilv0DjROR6KWX85t4eTIosZT1ICxRZICAHIim7E4G+eSIyd0AX2LmCEWbeH4moqFTcwICczOtuF1BvdargU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779410919; c=relaxed/simple; bh=s/wIBG5NxKMoL4hYtIPAozn8zgP9LqXai/CwodaF08A=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OcsZog4HdpifTWwLrpAQLkF2rHa7S8bX5ET1hoW3zizulpMot5aXxZnxFegNU1aDvuqL5GJnBo+R4crG/MxmWQ0Teos4fGSkveqdR1/y9d1/wygSxo7kKKG+vhBAz9d6lgngetnEkKtZx9GCG3OnwgUVarvI6pT4IaEkK1yR9Vg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b=VXBddCDp; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen.com header.i=@soleen.com header.b="VXBddCDp" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-8b4eb1fd5d0so84004006d6.0 for ; Thu, 21 May 2026 17:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; t=1779410917; x=1780015717; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=AUuo4Wsm5kupCrQA3m4DdC09avG22p4BEbUBdKbxJRo=; b=VXBddCDpeHHwyeuQOU33XABeDUHfXxSBoRO70zsOIVWBWJr5IyzMoBE24QadpDJ3nN zVl3o7+r63StwOYVBAT7Ppu5uoUKQZEfnDqOw3NSf5irDP137YrsOWzU0uAojzLs+zl3 pW7eZop0LK9t3UIEjFG+a+4ysOPh3Kw2T0my+0y3/h0pYF2Q5pZOF7d7JY93bShV4Ati CQrcMXz86sNN6QvOzfLD6djEo/V5SjcptPsVKNDYRc60kMHHCisgpXoaJb2//Y8NN8WM EETK62osUZBrhoznDc54drIgH0ggExIwwIbJA2Huu8Z7tkJGVtI2kPIJXdvtMrHrUj5p bTjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779410917; x=1780015717; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AUuo4Wsm5kupCrQA3m4DdC09avG22p4BEbUBdKbxJRo=; b=UOfwtuk7N32ewGp2gvSiqZFX63Y0VdXp0MJ68wAMJ3bhZcw/87FK4WjxZbxHTFRSe/ c4adfRhaKbZN4p7Ac3Yu6qmtMGpy9iLhROef7OQHXEKMefWYEffRSVaAQiRo1z4jLPHN CmZLuafE0BlA8GT9NTAOFFN1yKEoNuvtJFFjgMaCXx3BiCYkGTh34ftvkkKowCKiload QFrKe+5uCPSI77gXYfO/pOreIAo0ME/M/hp3mqiRBSc1XggMaj8TOZiXfGWzHQScvLb5 E0/R9XJ24wDqNm07jdJGd2iERKIULp0I3h0xMsag+B7QIWHhRaPbSBxNtCw8/UwvIK79 mNZg== X-Forwarded-Encrypted: i=1; AFNElJ9asf+NN036w6WtzLnxWUqSwh64h7UVO23VfneJQnC7vtpGf1p9W4vAyNGEovOEBGqIWHc318UM4RGnc+4=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/QsdHm3u+h9POKY9VHpn9QHjjOBOpETSdhJov39PKUVgQqgA4 Iek6a2A+60hNznYct2H4s29D4mvL3twM2Q/VQro8ACZ8xasNQfAPGDgctBtuKoKNAfk= X-Gm-Gg: Acq92OGqRpnXMmQ/L8AFuokBeWe6hF+ZQQdLFzQnBfpUQLK5F3IJlDXbs+WAJZYkRhL vY+Hs6QEAgceWb3l04272PibXYiXYmxif2SNOfEsu66F9tiL2W4cETyB3J0qOqCS3+z6zft/IWV kjAGvyH0WCse6bPMO/mxQFZVwxdiLvNsa1W+KhiLNz0SJGEzmNa+pqevq6/ni+pzB5VDL3lnpiT P/t5C6X5coOPVrSS/DRcNUjZxRxNrsmL/ofJejc8gANS/dcJWoXUMdVdqaEl65NDDMXmR455Nxx YVcHvGD0210SdMItoxOP+jDh7OFTi0RbkwuAWGf4oNkY+OZLERssy2AkA1A86GdwYR+imbHPFqC fqJk/qCCAXYw0iDvWmRrz023N3CbuFUlz1TjOe45cVrTrYcbRPzieYsaovsbZJsxgkNtpEK9+UT E0A1scC7He+wjxK288XKPGInJYa96XzqwqXwED8l5cuswJIoT/zrY= X-Received: by 2002:a05:6214:3204:b0:8cc:3546:2612 with SMTP id 6a1803df08f44-8cc7b55066fmr31946416d6.14.1779410916844; Thu, 21 May 2026 17:48:36 -0700 (PDT) Received: from plex ([71.181.43.54]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8cc81316e4esm3013256d6.41.2026.05.21.17.48.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 17:48:36 -0700 (PDT) Date: Fri, 22 May 2026 00:48:35 +0000 From: Pasha Tatashin To: Pratyush Yadav Cc: Mike Rapoport , Pasha Tatashin , Alexander Graf , Muchun Song , Oscar Salvador , David Hildenbrand , Andrew Morton , Jason Miu , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 09/12] memblock: introduce MEMBLOCK_KHO_SCRATCH_EXT Message-ID: References: <20260429133928.850721-1-pratyush@kernel.org> <20260429133928.850721-10-pratyush@kernel.org> <2vxzecjhc2s8.fsf@kernel.org> 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=us-ascii Content-Disposition: inline In-Reply-To: <2vxzecjhc2s8.fsf@kernel.org> On 05-11 18:46, Pratyush Yadav wrote: > On Mon, May 11 2026, Mike Rapoport wrote: > > > On Wed, Apr 29, 2026 at 03:39:11PM +0200, Pratyush Yadav wrote: > >> From: "Pratyush Yadav (Google)" > >> > >> In the upcoming commits, the KHO will learn how to discover free blocks > >> of memory by walking the KHO radix tree. It will then mark those regions > >> as scratch to allow memory allocation in case scratch runs low. > >> > >> To differentiate the extended scratch areas from the main scratch areas, > >> introduce MEMBLOCK_KHO_SCRATCH_EXT. Use it when choosing memblock flags > >> for allocations during scratch-only. Teach should_skip_region() to check > >> for both flags before deciding if the region should be skipped. > > > > Why there's a need to differentiate SCRATCH and SCRATCH_EXT? > > SCRATCH (I still hate the name) means "memory memblock can safely use for +1000 I also strongly dislike this name and mentioned it in another thread earlier today. If we ever decide to s/scratch/something-else/ globally, that should be a separate cleanup effort. However, since we are introducing a brand new flag here, we can discuss a better name for the _ext portion to avoid overloading the "scratch" concept. > > the allocations". Initially this memory comes from the reservations in the > > first kernel, but if the second kernel can find more memory to extend it, > > why that additional memory should be treated differently? > > Two reasons: > > 1. We mark SCRATCH as MIGRATE_CMA. We don't want to do that for > SCRATCH_EXT since this memory can be used for non-movable > allocations. > > 2. Gigantic (1G) huge pages can not be allocated from scratch. They can > be preserved memory and thus should not be allocated from SCRATCH. > See patch 12 that does allocations for gigantic huge pages only from > SCRATCH_EXT. > > I will add this in the commit message for the next version. > > Naming is hard, so if you have any better names I'm all ears :-) IMO, this scratch_ext is not "scratch" in the traditional KHO sense at all. The traditional KHO scratch is what is passed from kernel to kernel and is guaranteed to contain zero preserved memory. This new memory is not passed from kernel to kernel and can contain preserved memory at runtime. It's essentially just memory that we identify as currently unpreserved and release early to the system. If we want to keep the naming aligned with the existing codebase for now: MEMBLOCK_KHO_SCRATCH -> original scratch MEMBLOCK_KHO_UNPRESERVED -> for the new memory (instead of SCRATCH_EXT) Alternatively, if we do want to tackle the global rename of "scratch" later: MEMBLOCK_KHO_BOOTSTRAP -> for the original scratch MEMBLOCK_KHO_UNPRESERVED -> for this new dynamic memory What do you think? Pasha > > > > >> Signed-off-by: Pratyush Yadav (Google) > >> --- > >> > >> Notes: > >> Checkpatch complains about no space after MEMBLOCK_KHO_SCRATCH_EXT in > >> the declaration, but doing so makes it nicely align with all the other > >> numbers. Mike, if you'd like I can add some whitespace. > >> > >> include/linux/memblock.h | 10 ++++++++++ > >> mm/memblock.c | 41 ++++++++++++++++++++++++++++++++++------ > >> 2 files changed, 45 insertions(+), 6 deletions(-) > > -- > Regards, > Pratyush Yadav