Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pranjal Shrivastava <praan@google.com>
To: Mike Rapoport <rppt@kernel.org>
Cc: Pasha Tatashin <pasha.tatashin@soleen.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	Alexander Graf <graf@amazon.com>,
	Samiullah Khawaja <skhawaja@google.com>,
	David Matlack <dmatlack@google.com>,
	kexec@lists.infradead.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2 2/2] kho: Introduce preserve/restore APIs for unsplit pages
Date: Wed, 22 Jul 2026 21:19:53 +0000	[thread overview]
Message-ID: <amEz-Tv7H7O1VVij@google.com> (raw)
In-Reply-To: <178456663513.143128.14871307686052703561.b4-review@b4>

On Mon, Jul 20, 2026 at 07:57:15PM +0300, Mike Rapoport wrote:
> > The current KHO page preservation APIs (e.g. kho_preserve_pages) assume
> > that multi-page blocks are split into independent 4KB pages during
> > restoration. This is incompatible with high-order non-compound pages,
> > such as DMA buffers, which must be restored with tail pages having a
> > zero reference count.
> > 
> > Introduce explicit preserve and restore APIs for unsplit pages,
> 
>                                  high-order non-compound ^
> 

Ack, will update the commit msg.

> > which preserve and restore a high-order page block as a single unit,
> > applying a refcount of 1 to the head page while leaving tail pages at 0.
> > Rename the existing internal helper to __kho_restore_page().
> > 
> > Signed-off-by: Pranjal Shrivastava <praan@google.com>
> >
> > diff --git a/include/linux/kexec_handover.h b/include/linux/kexec_handover.h
> > index 8968c56d2d73e..6e2c75b16209c 100644
> > --- a/include/linux/kexec_handover.h
> > +++ b/include/linux/kexec_handover.h
> > @@ -22,6 +22,8 @@ bool is_kho_boot(void);
> >  

[...]

> > +struct page *kho_restore_page(phys_addr_t phys)
> > +{
> > +	struct page *page = pfn_to_online_page(PHYS_PFN(phys));
> > +	unsigned long nr_pages;
> > +	union kho_page_info info;
> > +
> > +	if (!page)
> > +		return NULL;
> > +
> > +	info.page_private = page->private;
> > +	if (WARN_ON_ONCE(info.magic != KHO_PAGE_MAGIC))
> > +		return NULL;
> > +
> > +	nr_pages = (1UL << info.order);
> > +	page->private = 0;
> > +
> > +	kho_init_unsplit_pages(page, info.order);
> > +	adjust_managed_page_count(page, nr_pages);
> > +
> > +	return page;
> 
> Hmm, it copies a lot from __kho_init_page().
> We should keep the common part of order-0 page/folio/high-order page
> initialization in a single place.
> 

Alright, I'll break out a helper.

Thanks,
Praan


      reply	other threads:[~2026-07-22 21:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-13 20:49 [RFC PATCH v2 0/2] kho: support preserving unsplit high-order pages Pranjal Shrivastava
2026-07-13 20:49 ` [RFC PATCH v2 1/2] kho: Introduce a helper to init unsplit pages Pranjal Shrivastava
2026-07-13 21:26   ` Samiullah Khawaja
2026-07-20 16:57   ` Mike Rapoport
2026-07-22 21:18     ` Pranjal Shrivastava
2026-07-13 20:49 ` [RFC PATCH v2 2/2] kho: Introduce preserve/restore APIs for " Pranjal Shrivastava
2026-07-20 16:57   ` Mike Rapoport
2026-07-22 21:19     ` Pranjal Shrivastava [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=amEz-Tv7H7O1VVij@google.com \
    --to=praan@google.com \
    --cc=dmatlack@google.com \
    --cc=graf@amazon.com \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=pratyush@kernel.org \
    --cc=rppt@kernel.org \
    --cc=skhawaja@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox