>>> >>> Also, struct page (memmap) might not be always contiguous, using struct page >>> points to represent folio range might not give the result you want. >>> See nth_page() and folio_page_idx() in include/linux/mm.h. >> >> Is that true for pages within the same folio too? Or are all pages in a folio >> guarranteed contiguous? Perhaps I'm better off using pfn? > > folio_page_idx() says not all pages in a folio is guaranteed to be contiguous. > PFN might be a better choice. Hi Zi, Matthew, Zi made this comment a couple of months back that it is incorrect to assume that `struct page`s within a folio are (virtually) contiguous. I'm not sure if that's really the case though? I see other sites in the source that do page++ when iterating over a folio. e.g. smaps_account(), splice_folio_into_pipe(), __collapse_huge_page_copy(), etc. Any chance someone could explain the rules? Thanks, Ryan