On Thu, Sep 15, 2022 at 08:36:37PM -0700, Dan Williams wrote: > Track entries and take pgmap references at mapping insertion time. > Revoke mappings (dax_zap_mappings()) and drop the associated pgmap > references at device destruction or inode eviction time. With this in > place, and the fsdax equivalent already in place, the gup code no longer > needs to consider PTE_DEVMAP as an indicator to get a pgmap reference > before taking a page reference. > > In other words, GUP takes additional references on mapped pages. Until > now, DAX in all its forms was failing to take references at mapping > time. With that fixed there is no longer a requirement for gup to manage > @pgmap references. However, that cleanup is saved for a follow-on patch. A page->pgmap must be valid and stable so long as a page has a positive refcount. Once we fixed the refcount GUP is automatically fine. So this explanation seems confusing. If dax code needs other changes to maintain that invarient it should be spelled out what those are and why, but the instant we fix the refcount we can delete the stuff in gup.c and everywhere else. Jason