On Tue, Feb 8, 2022 at 10:49 PM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > On Tue, Feb 08, 2022 at 04:04:32PM +0800, Muchun Song wrote: > > How about the name pvmw_set_pfn_from_page()? > > When I looked at your next patch, I'm feeling this helper > > is used to set up the pfn from a page instead of setting up > > the page. > > But it doesn't just set up the pfn, it also sets up the range and > the pgoff. > > I wonder if we wouldn't be better off with this pattern: > > DEFINE_PAGE_VMA_WALK(pvmw, page, vma, address, flags); The approach sounds good to me. How about the following names? DEFINE_PAGE_VMA_WALK_FROM_PAGE(pvmw, page, vma, address, flags); This is used for most users that want to walk the whole page. DEFINE_PAGE_VMA_WALK(pvmw, pfn, nr_pages, pgoff, vma, address, flags); This is used for users that have no struct page or the user like page_mapped_in_vma() which only wants to walk the part of compound page. Thanks. > > ... which wouldn't get used by KSM, but could be used by > most other callers. >