Re: [PATCH 2/4] mm: add a template-based fast path for zone-device page init

From: Mike Rapoport

Date: Mon May 18 2026 - 07:45:34 EST


On Mon, May 18, 2026 at 05:54:05PM +0800, Li Zhe wrote:
> On Mon, 18 May 2026 09:51:34 +0300, rppt@xxxxxxxxxx wrote:
>
> > > +#ifdef WANT_PAGE_VIRTUAL
> > > + if (!is_highmem_idx(ZONE_DEVICE))
> > > + set_page_address(page, __va(pfn << PAGE_SHIFT));
> >
> > set_page_address() is a not when WANT_PAGE_VIRTUAL, you can drop the ifdef.
>
> Upon checking the implementation, set_page_address() also has another
> implementation for HASHED_PAGE_VIRTUAL
>
> Following the style of __init_single_page(), we only want to call
> set_page_address() under WANT_PAGE_VIRTUAL for ZONE_DEVICE initialization,
> so would it be acceptable to keep the #ifdef guard here?

Since there's no other option, keep the ifdef.

--
Sincerely yours,
Mike.