[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aMGc-ExhkqwAyY_C@casper.infradead.org>
Date: Wed, 10 Sep 2025 16:44:56 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Pratyush Yadav <pratyush@...nel.org>
Cc: Alexander Graf <graf@...zon.com>, Mike Rapoport <rppt@...nel.org>,
Changyuan Lyu <changyuanl@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Baoquan He <bhe@...hat.com>,
Pasha Tatashin <pasha.tatashin@...een.com>,
Jason Gunthorpe <jgg@...dia.com>, Chris Li <chrisl@...nel.org>,
Jason Miu <jasonmiu@...gle.com>, linux-kernel@...r.kernel.org,
kexec@...ts.infradead.org, linux-mm@...ck.org
Subject: Re: [PATCH] kho: make sure folio being restored is actually from KHO
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.
Powered by blists - more mailing lists