From mboxrd@z Thu Jan 1 00:00:00 1970 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 BD3E43D3D1C for ; Mon, 11 May 2026 16:46:35 +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=1778517995; cv=none; b=mmO56a01LYcQ5vfvToN9LuXbma1eAz5MtVoH45MQDt5qseRrgp8OXdlJESgqo8TCygJ0efCPrqd9eH7dJ4YpUPYC+B0uYQAQYD+ZlTVyN0naIe6IA/gtvXdfWmzx6sBtRTllUhcM47NpSSspWibxO5vCXuWPJ+ikxOMcuvIQM28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778517995; c=relaxed/simple; bh=bw1iSp23wIs22ISN/RndBuh+7+IBivBG0cops6DsbD8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=DpoO9Khj96+zogC83XDY7ZFp0/eEMb22q6aWCIyLiTKgeBrjP5Xdl8QyoBMgYRpxi4dg1CzCg60GvC8yYqaNfhZkG5+hdRw/s7Z4kVEzcTuhg3rhqoxXFcaf8xTS5q1tlHOOGR0qvhv23/LU6xr46x3A30I1XlXgVMC7MCnvsXA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GYQyVF0d; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GYQyVF0d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 671B6C2BCB0; Mon, 11 May 2026 16:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1778517995; bh=bw1iSp23wIs22ISN/RndBuh+7+IBivBG0cops6DsbD8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=GYQyVF0dodcnUtJFTeC3X6pBLZ91yI70qFAz9UI53t7Q0FVCJa3pgjktMCFALEF69 oFf86juGHdTTIx18+2++QfRgKVI/HsuKVJjpLA2YQHi2BHwP7iP4b2rDKOoXFAGDsZ V6fW/otEE1ZlCA+SN9dsIevnW2msNppbiRYuSsLRnCiHukzao+82/kUJujVQ36Z7uz FzXWDDyoSP6rMmM1WtGNgeYVuGySa5JT9xFKBJWyZ9rpD4cT6rFQGGSo3YH3LM9xrV lf1cXfbMfcPqfBsW2BVAMoFeWtAJv7Q1CNFvKB8pBreZ9Lhr3L9wZAHJOwtFwVM4xi 6vuaKLjRTYdIg== From: Pratyush Yadav To: Mike Rapoport Cc: Pratyush Yadav , 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 In-Reply-To: (Mike Rapoport's message of "Mon, 11 May 2026 15:06:19 +0300") References: <20260429133928.850721-1-pratyush@kernel.org> <20260429133928.850721-10-pratyush@kernel.org> Date: Mon, 11 May 2026 18:46:31 +0200 Message-ID: <2vxzecjhc2s8.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain 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 > 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 :-) > >> 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