Hi,

I came across commit 8b93d1d7dbd5 ("drm/shmem-helper: Switch to vmf_insert_pfn") from 2021, which makes it very clear the PFNMAP is strongly preferred over pages. I totally forgot about that change. The next iteration of this series will therefore not contain this patch.

Best regards
Thomas

Am 04.02.26 um 17:03 schrieb Matthew Wilcox:
On Wed, Feb 04, 2026 at 12:39:30PM +0100, Thomas Zimmermann wrote:
+       ret = drm_gem_shmem_try_map_pmd(vmf, vmf->address, page);
+       if (ret != VM_FAULT_NOPAGE) {
+               struct folio *folio = page_folio(page);
+
+               get_page(page);
folio_get(folio);

-       pfn = page_to_pfn(pages[page_offset]);
-       ret = vmf_insert_pfn(vma, vmf->address, pfn);
+               folio_lock(folio);
+
+               vmf->page = page;
+               ret = VM_FAULT_LOCKED;
+       }
- out:
+out:
        dma_resv_unlock(shmem->base.resv);
return ret;
@@ -689,7 +698,7 @@ int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, 
struct vm_area_struct
        if (ret)
                return ret;
- vm_flags_set(vma, VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP);
+       vm_flags_mod(vma, VM_DONTEXPAND | VM_DONTDUMP, VM_PFNMAP);
Do you need to explicitly clear VM_PFNMAP here?  I'm not familiar with
the DRM stack; maybe that's set for you higher in the stack.


--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)


Reply via email to