Re: [PATCH v6 3/8] mm: add a set_page_section_from_pfn() helper
Muchun Song <[email protected]>
| Newsgroups | org.kernel.vger.linux-arch,org.kernel.vger.linux-hardening,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
> On Jul 9, 2026, at 19:25, Li Zhe <[email protected]> wrote: > > Callers that want to update section bits from a PFN currently need to > open-code: > > set_page_section(page, pfn_to_section_nr(pfn)); > > and guard that sequence with #ifdef SECTION_IN_PAGE_FLAGS. > > Add set_page_section_from_pfn() to wrap that update in one place. When > section bits are stored in page flags, the helper derives the section > number from the PFN and updates the page flags. Otherwise keep it as a > no-op so callers can use one helper without open-coding > SECTION_IN_PAGE_FLAGS. > > Convert set_page_links() to use the new helper so later ZONE_DEVICE > fast-path patches can also update section bits without open-coding > SECTION_IN_PAGE_FLAGS at each callsite. > > This keeps the PFN-to-section translation local to the configurations > that actually store section bits in struct page flags, and avoids > exposing that detail to generic callers. > > No functional change intended. > > Signed-off-by: Li Zhe <[email protected]> > Reviewed-by: Mike Rapoport (Microsoft) <[email protected]> Acked-by: Muchun Song <[email protected]>