On Wed, Nov 17, 2021 at 02:54:08PM -0700, Logan Gunthorpe wrote: > When P2PDMA pages are passed to userspace, they will need to be > reference counted properly and returned to their genalloc after their > reference count returns to 1. This is accomplished with the existing > DEV_PAGEMAP_OPS and the .page_free() operation. > > Change CONFIG_P2PDMA to select CONFIG_DEV_PAGEMAP_OPS and add > MEMORY_DEVICE_PCI_P2PDMA to page_is_devmap_managed(), > devmap_managed_enable_[put|get]() and free_devmap_managed_page(). Uuuh. We are trying hard to kill off this magic free at refcount 1 behavior in the amdgpu device coherent series. We really should not add more of this.