On Tue, Jun 03, 2025 at 11:16:34PM +0200, David Hildenbrand wrote: > Marking PUDs that map a "normal" refcounted folios as special is > against our rules documented for vm_normal_page(). > > Fortunately, there are not that many pud_special() check that can be > mislead and are right now 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 introduce > folio_normal_page_pud() and start using it in more place where we > currently special-case based on other VMA flags. > > Fix it by just inlining the relevant code, making the whole > pud_none() handling cleaner. > > Add folio_mk_pud() to mimic what we do with folio_mk_pmd(). > > While at it, make sure that the pud that is non-none is actually present > before comparing PFNs. > > Fixes: dbe54153296d ("mm/huge_memory: add vmf_insert_folio_pud()") > Signed-off-by: David Hildenbrand <da...@redhat.com>
Reviewed-by: Oscar Salvador <osalva...@suse.de> -- Oscar Salvador SUSE Labs