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 E838E32E720 for ; Fri, 14 Nov 2025 16:16:07 +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=1763136968; cv=none; b=KGwXK1bMQXoiTOi2qPq7VSOIbBeqXvs0uAty57UgC/ulj1c6FNJhej/Xu2NyNScK2RaBOIbb0ZC7wKqPKDDb7t1FujKXxv0Yz9Hr8ncC/K6Pa7AK4d7E3NqSEJc5fOrSGQskLhtPV8/3IojEtAQ/z4Eaqp70wD1ruZs8pFuAue0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763136968; c=relaxed/simple; bh=tSxN8dD+nQ8F1DqUN5WT//XcohZgIvkWhnqveOTbdS4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WmWIEkTzPx1bTXJqHnqlsNahVy3r0o54WSo1vSCO89bXRfP6rDBIA3L8F8ce/j9FtZdT1OqJ0McCT60QwUsryjv/cITTdZIWSpt2rzjC7bAk9WHipMSI+265xS3USdqg6zRvvk6lmgzrDifAa1DuLYQ/Qh5EQABTnmVi68ghfoU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RyWrUZmi; 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="RyWrUZmi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16AA4C116B1; Fri, 14 Nov 2025 16:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1763136967; bh=tSxN8dD+nQ8F1DqUN5WT//XcohZgIvkWhnqveOTbdS4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RyWrUZmiPavdad5/L4Ku4XTi4TroUF34qqpGQ2vIK5Mb+GKYPyKWzhjiNLEd4eT2e UVXjYV9X+p75gEgGgQGz51BDugj6dLOcRxf/VtpXcPTXatrH+9uNm5doI0218B3bwk Y2Hg7roLrSqqgo25csIUK5gOEatcZZsUU3dkiavyuOFbjg48aE5Y2hvGJyyrDDRWsj 2xMxNTw5GvJRhE3w7q4MlB5q8T2wrOI7/qyovv4wx3MUPDtocUVMtWPmRVLXtriwQC 7MQ0J/Goo7rfaJLwR7Of0FxWUIrNKVvaNp8SDsUNbxX54AOCr97HvybItXlgCaUcSZ u1xzn7yEwSdHw== Date: Fri, 14 Nov 2025 18:15:59 +0200 From: Mike Rapoport To: Pasha Tatashin Cc: akpm@linux-foundation.org, bhe@redhat.com, jasonmiu@google.com, arnd@arndb.de, coxu@redhat.com, dave@vasilevsky.ca, ebiggers@google.com, graf@amazon.com, kees@kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org Subject: Re: [PATCH v1 13/13] kho: Introduce high-level memory allocation API Message-ID: References: <20251114155358.2884014-1-pasha.tatashin@soleen.com> <20251114155358.2884014-14-pasha.tatashin@soleen.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=us-ascii Content-Disposition: inline In-Reply-To: <20251114155358.2884014-14-pasha.tatashin@soleen.com> On Fri, Nov 14, 2025 at 10:53:58AM -0500, Pasha Tatashin wrote: > Currently, clients of KHO must manually allocate memory (e.g., via > alloc_pages), calculate the page order, and explicitly call > kho_preserve_folio(). Similarly, cleanup requires separate calls to > unpreserve and free the memory. > > Introduce a high-level API to streamline this common pattern: > > - kho_alloc_preserve(size): Allocates physically contiguous, zeroed > memory and immediately marks it for preservation. > - kho_free_unpreserve(ptr, size): Unpreserves and frees the memory > in the current kernel. > - kho_free_restore(ptr, size): Restores the struct page state of > preserved memory in the new kernel and immediately frees it to the > page allocator. It would have been nice to have it before patch 3 (Preserve FDT folio only once during initialization) and use kho_alloc_preserve() for KHO's own FDT. > Signed-off-by: Pasha Tatashin > --- > include/linux/kexec_handover.h | 22 +++++-- > kernel/liveupdate/kexec_handover.c | 101 +++++++++++++++++++++++++++++ > 2 files changed, 116 insertions(+), 7 deletions(-) -- Sincerely yours, Mike.