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 A8FE01C84A2 for ; Sun, 17 May 2026 10:17:57 +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=1779013077; cv=none; b=QycReOv1Z7yBTnVdxImdNHjaxJxfT7zJX7hw1yx23MFVv8JbiW0eOWoVgemqHJr/qupPNm8l+fSmxbWG2w3rpXzW0gUVCT6eTJLTNUV0u2VEPSd1UBqJTHanEVG9dt+6+Ztwxo+SsUigCCgBswTKhEFUk8z1NV/V+09cRGG2lDU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779013077; c=relaxed/simple; bh=I0qBvfgj53Jp++THC/CCO/kmcft0x3HCmB3+tnF/LrU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=mvMcjuDiw0bZjIJ7+l30vttdkAZODdhMZl/hsXDhdXPXSbNybPB0eHvnYruBJ9hDOkr8RsRYDoB3cEycpizGB8zxlCfEM0/KdgqLuKHIWtdrDbmyuUyx64a54LHXeOCNVbbqJEcfSgVYu24g0njsUZULQMtz9OdgABXQQ26+6M8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BrB+T16n; 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="BrB+T16n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A241C2BCB0; Sun, 17 May 2026 10:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1779013077; bh=I0qBvfgj53Jp++THC/CCO/kmcft0x3HCmB3+tnF/LrU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BrB+T16nkVTMYt7xlK0QT3nNBbBQ+u+K50tCW25pJhVN7Tk8vwPMUY6PohUVHQirK Jo8KYGxg5BGZCUOkJA3Bl1g6m4lKrOEK99Z4tKh2Aah2YmetX8SZZ90yEkmLkD65Z4 K8JC/2KDCJwfgxlPArmvmM3oyufCLsftE/evV74sNDUN4gytbYFqRQtbvxO71Xxhgg bda/SQC65qNuJOutl7qu6rWZcHGKXV5WutSxCYxd649o/XUrgEEmUllL/DlriJDShh VsoGofQGL1PgRdBPxkmIdkR2y+Nau7KHQwsMr3VTaSUFbF/1hYlIPlV0q/A4TAGJaQ zGyVf7Hno9FGQ== Date: Sun, 17 May 2026 13:17:50 +0300 From: Mike Rapoport To: Pratyush Yadav Cc: 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 10/12] kho: extended scratch Message-ID: References: <20260429133928.850721-1-pratyush@kernel.org> <20260429133928.850721-11-pratyush@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: <20260429133928.850721-11-pratyush@kernel.org> On Wed, Apr 29, 2026 at 03:39:12PM +0200, Pratyush Yadav wrote: > From: "Pratyush Yadav (Google)" > > Methodology > =========== > > Introduce extended scratch areas. These areas are discovered at boot by > walking the preserved memory radix tree and looking for free blocks of > memory. They then marked as scratch to allow allocations from them. This > makes KHO more resilient to memory pressure and allows supporting huge > page preservation. > > Since the preserved memory radix tree mixes both physical address and > order into a single key, and does not track table pages, it is difficult > to identify free areas from it directly. Walk the tree and digest it > down into another radix tree. The latter tracks blocks of > KHO_EXT_SHIFT (1 GiB as of now) granularity. Then walk the digested tree > and mark the areas between the present keys as scratch. > > Signed-off-by: Pratyush Yadav (Google) > --- > include/linux/kexec_handover.h | 1 + > kernel/liveupdate/kexec_handover.c | 148 +++++++++++++++++++++++++---- > mm/mm_init.c | 1 + > 3 files changed, 133 insertions(+), 17 deletions(-) > > diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c > index 1a04e089f779..c2b843a5fb28 100644 > --- a/kernel/liveupdate/kexec_handover.c > +++ b/kernel/liveupdate/kexec_handover.c > @@ -840,6 +857,120 @@ static void __init kho_reserve_scratch(void) > kho_enable = false; > } > > +#define KHO_EXT_SHIFT 30 /* 1 GiB */ arm64 does not necessarily use 1G gigantic pages and worse, it can have 2 gigantic hstates. I think this should take into account what actual gigantic page sizes are in use for the general case. -- Sincerely yours, Mike.