Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pranjal Shrivastava <praan@google.com>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: Mike Rapoport <rppt@kernel.org>,
	Pasha Tatashin <pasha.tatashin@soleen.com>,
	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: [PATCH v4 2/2] kho: Introduce preserve/restore APIs for high-order pages
Date: Wed, 12 Aug 2026 12:46:43 +0000	[thread overview]
Message-ID: <anxrM6HPKPq74So3@google.com> (raw)
In-Reply-To: <2vxzmrur3880.fsf@kernel.org>

On Wed, Aug 12, 2026 at 01:10:23PM +0200, Pratyush Yadav wrote:
> On Mon, Aug 03 2026, Pranjal Shrivastava 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 high-order pages,
> > 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() and
> > consolidate the common restoration code into it.
> >
> > Signed-off-by: Pranjal Shrivastava <praan@google.com>
> 
> The code here looks very convoluted TBH. I think it will be simpler to
> make kho_restore_page() only return non-compound pages. That is, it
> returns 0 or higher order non-compound page.
> 
> Then kho_restore_pages() can call kho_restore_page() and then do
> split_page() on the page it got to turn it into 0-order pages.
> kho_restore_folio() can call kho_restore_page() and then do
> prep_compound_page() on the page it got.
> 
> And then you expose kho_restore_page() to be used by DMA APIs to get
> non-compound high order pages directly.
> 
> How does that sound?
> 

I like the suggestion to use a single base primitive and mold it via
split_page() and prep_compound_page().

However, To implement this, we'll need __kho_restore_page(phys, &order)
as the internal base primitive because callers (like kho_restore_folio)
need to retrieve the order from the KHO metadata to pass into 
prep_compound_page(), and a raw non-compound struct page doesn't store 
its order.

By having __kho_restore_page() initialize the head_ref = 1 & all_tails
=0 refcount pattern by default, all three public APIs can just wrap it
and call the appropriate MM subsystem helpers. I'll spin v5 with this

Thanks,
Praan


  reply	other threads:[~2026-08-12 12:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03 11:39 [PATCH v4 0/2] kho: support preserving high-order non-compound pages Pranjal Shrivastava
2026-08-03 11:39 ` [PATCH v4 1/2] kho: Introduce a helper to init high order pages Pranjal Shrivastava
2026-08-12 10:54   ` Pratyush Yadav
2026-08-12 12:33     ` Pranjal Shrivastava
2026-08-03 11:39 ` [PATCH v4 2/2] kho: Introduce preserve/restore APIs for high-order pages Pranjal Shrivastava
2026-08-12 11:10   ` Pratyush Yadav
2026-08-12 12:46     ` Pranjal Shrivastava [this message]
2026-08-12 13:49       ` Pratyush Yadav
2026-08-11 10:27 ` [PATCH v4 0/2] kho: support preserving high-order non-compound pages Mike Rapoport
2026-08-12 10:32   ` Pratyush Yadav
2026-08-12 12:49     ` Pranjal Shrivastava
2026-08-12 13:46       ` Pratyush Yadav

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=anxrM6HPKPq74So3@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