From: Matthew Wilcox <willy@infradead.org>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: Alexander Graf <graf@amazon.com>, Mike Rapoport <rppt@kernel.org>,
Changyuan Lyu <changyuanl@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Baoquan He <bhe@redhat.com>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Jason Gunthorpe <jgg@nvidia.com>, Chris Li <chrisl@kernel.org>,
Jason Miu <jasonmiu@google.com>,
linux-kernel@vger.kernel.org, kexec@lists.infradead.org,
linux-mm@kvack.org
Subject: Re: [PATCH] kho: make sure folio being restored is actually from KHO
Date: Wed, 10 Sep 2025 16:44:56 +0100 [thread overview]
Message-ID: <aMGc-ExhkqwAyY_C@casper.infradead.org> (raw)
In-Reply-To: <20250910153443.95049-1-pratyush@kernel.org>
On Wed, Sep 10, 2025 at 05:34:40PM +0200, Pratyush Yadav wrote:
> +#define KHO_PAGE_MAGIC 0x4b484f50U /* ASCII for 'KHOP' */
> +
> +/*
> + * KHO uses page->private, which is an unsigned long, to store page metadata.
> + * Use it to store both the magic and the order.
> + */
> +union kho_page_info {
> + unsigned long page_private;
> + struct {
> + unsigned int order;
> + unsigned int magic;
> + };
KHO is only supported on 64-bit?
> @@ -210,16 +226,16 @@ static void kho_restore_page(struct page *page, unsigned int order)
> struct folio *kho_restore_folio(phys_addr_t phys)
> {
> struct page *page = pfn_to_online_page(PHYS_PFN(phys));
> - unsigned long order;
> + union kho_page_info info;
>
> if (!page)
> return NULL;
>
> - order = page->private;
> - if (order > MAX_PAGE_ORDER)
> + info.page_private = page->private;
> + if (info.magic != KHO_PAGE_MAGIC || info.order > MAX_PAGE_ORDER)
> return NULL;
>
> - kho_restore_page(page, order);
> + kho_restore_page(page, info.order);
> return page_folio(page);
This all looks very confused. Before your patch as well as after it.
I don't see anything in the current KHO code that requires the
phys_addr_t to be order-aligned.
next prev parent reply other threads:[~2025-09-10 15:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-10 15:34 Pratyush Yadav
2025-09-10 15:44 ` Matthew Wilcox [this message]
2025-09-10 15:52 ` Pratyush Yadav
2025-09-10 15:55 ` Jason Gunthorpe
2025-09-16 13:20 ` Pratyush Yadav
2025-09-16 13:27 ` Jason Gunthorpe
2025-09-16 14:52 ` Pratyush Yadav
2025-09-16 14:37 ` Mike Rapoport
2025-09-16 14:55 ` 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=aMGc-ExhkqwAyY_C@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=changyuanl@google.com \
--cc=chrisl@kernel.org \
--cc=graf@amazon.com \
--cc=jasonmiu@google.com \
--cc=jgg@nvidia.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 \
/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