On Tue, Jun 03, 2025 at 11:16:33PM +0200, David Hildenbrand wrote: > Marking PMDs that map a "normal" refcounted folios as special is > against our rules documented for vm_normal_page(). > > Fortunately, there are not that many pmd_special() check that can be > mislead, and most vm_normal_page_pmd()/vm_normal_folio_pmd() users that > would get this wrong right now are rather harmless: e.g., none so far > bases decisions whether to grab a folio reference on that decision. > > Well, and GUP-fast will fallback to GUP-slow. All in all, so far no big > implications as it seems. > > Getting this right will get more important as we use > folio_normal_page_pmd() in more places. > > Fix it by just inlining the relevant code, making the whole > pmd_none() handling cleaner. We can now use folio_mk_pmd(). > > While at it, make sure that a pmd that is not-none is actually present > before comparing PFNs. > > Fixes: 6c88f72691f8 ("mm/huge_memory: add vmf_insert_folio_pmd()") > Signed-off-by: David Hildenbrand <da...@redhat.com>
Reviewed-by: Oscar Salvador <osalva...@suse.de> -- Oscar Salvador SUSE Labs