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 E5EE72C08C2 for ; Mon, 29 Dec 2025 20:52:41 +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=1767041562; cv=none; b=azxlB5t5mL8pT9UpkVgOtQnxS52q57WGrTtPfx8csidAHu2PPfe7hy/g5tP6hllEyPs1UFgkTxfr9Dwc4x0DPk2xx5FRJkiROqK/6XFSt6c4sc/CxL8B6ksSYgkAS3dBrGYc2wKBqtxfuCjvhW1eK4w/9JU51nK/XVQy7umWQlA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767041562; c=relaxed/simple; bh=MwPgzvD78n3pW90vWtwAVJoET5+u4jzMiVKZ1kjYoMM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=AabwFuWgn5L9ePANW8/UqKaeAPiRav/r8QQQrRB+WqyclIjoZOcyjqRPnO2idf50xESEm6uM4V0aEpLl5WJTdG91OrdZCMuJefh6zA+fKoc7vN22j9wIuyMyTN90uowLhi2geRyR77rsjIsRA1d4/pRLt5LH+iwtiy8mk1zp+4M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UgX7+Akl; 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="UgX7+Akl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5167C4CEF7; Mon, 29 Dec 2025 20:52:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767041561; bh=MwPgzvD78n3pW90vWtwAVJoET5+u4jzMiVKZ1kjYoMM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=UgX7+AkltaYMgD/psdVzZtaRdtN4IQkW/L62pxQLIpOZU5+2igPik9iHaYIuXbpvn lf+6ZtmgovxFo3WJ/g5L6uwhSXEko/5MDlib/U+xUEZlrqWeBeELPMqGTtB0NWebdA tlL8FScMql/gqwNNxDZXkYeoNAFrKbJsZJTsgDAEQRI0MUx67zlDWAHtTzRHv0WN+v hzH5NVYupexrRdVyfO1thgNLpV604PjbDfTz9Fcw3H+ZCPMkJKkNSeI8szZcV6vCbB uvZe6Ewy0vj89rsxgYcrgjxOKXpkOLc6mUZlDGceI9K/HvTvMyM/1gaeLqKJGSU80z d3ntCSsWSi/IQ== From: Pratyush Yadav To: Pasha Tatashin Cc: Pratyush Yadav , Andrew Morton , Alexander Graf , Mike Rapoport , kexec@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] kho: simplify page initialization in kho_restore_page() In-Reply-To: (Pasha Tatashin's message of "Tue, 23 Dec 2025 12:49:39 -0500") References: <20251223104448.195589-1-pratyush@kernel.org> Date: Mon, 29 Dec 2025 21:52:37 +0100 Message-ID: <868qel9fje.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; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Dec 23 2025, Pasha Tatashin wrote: > On Tue, Dec 23, 2025 at 5:45=E2=80=AFAM Pratyush Yadav wrote: >> >> When restoring a page (from kho_restore_pages()) or folio (from >> kho_restore_folio()), KHO must initialize the struct page. The >> initialization differs slightly depending on if a folio is requested or >> a set of 0-order pages is requested. >> >> Conceptually, it is quite simple to understand. When restoring 0-order >> pages, each page gets a refcount of 1 and that's it. When restoring a >> folio, head page gets a refcount of 1 and tail pages get 0. >> >> kho_restore_page() tries to combine the two separate initialization flow >> into one piece of code. While it works fine, it is more complicated to >> read than it needs to be. Make the code simpler by splitting the two >> initalization paths into two separate functions. This improves >> readability by clearly showing how each type must be initialized. >> >> Signed-off-by: Pratyush Yadav >> --- >> >> Notes: >> This patch is a follow up from >> https://lore.kernel.org/linux-mm/86ms42mj44.fsf@kernel.org/ >> >> kernel/liveupdate/kexec_handover.c | 41 ++++++++++++++++++++---------- >> 1 file changed, 27 insertions(+), 14 deletions(-) >> >> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexe= c_handover.c >> index 2d9ce33c63dc..304c26fd5ee6 100644 >> --- a/kernel/liveupdate/kexec_handover.c >> +++ b/kernel/liveupdate/kexec_handover.c >> @@ -219,11 +219,33 @@ static int __kho_preserve_order(struct kho_mem_tra= ck *track, unsigned long pfn, >> return 0; >> } >> >> +/* For physically contiguous 0-order pages. */ >> +static void kho_init_pages(struct page *page, unsigned int nr_pages) > > Here and in other places below, it is better for nr_pages to be > unsigned long. This is consistent with other places in mm, where we > have gradually moved on from int/unsigned int to unsigned long for > npages (see gup.c for example). Otherwise, LGTM. Thanks. Will do. [...] --=20 Regards, Pratyush Yadav