]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/vmwgfx: Use VM_PFNMAP instead of VM_MIXEDMAP when possible
authorThomas Hellstrom <thellstrom@vmware.com>
Wed, 4 Dec 2019 10:42:15 +0000 (11:42 +0100)
committerThomas Hellstrom <thellstrom@vmware.com>
Wed, 15 Jan 2020 13:34:49 +0000 (14:34 +0100)
For shared, and read-only private mappings of graphics memory, use
VM_PFNMAP instead of VM_MIXEDMAP. This means less accounting overhead
when inserting and removing page-table entries. TTM doesn't do this
by default, since there was a performance problem with book-keeping of
write-combined mappings. Since vmwgfx solely uses cached mappings, that's
not a problem and now that the TTM vm has largely been turned into
helpers, we can use VM_PFNMAP on a per-driver basis

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c

index ce288756531ba7d7041876b54521d1996c5de485..aa7e50f63b94673e46c9417c5b68c239b924f56c 100644 (file)
@@ -45,6 +45,10 @@ int vmw_mmap(struct file *filp, struct vm_area_struct *vma)
 
        vma->vm_ops = &vmw_vm_ops;
 
+       /* Use VM_PFNMAP rather than VM_MIXEDMAP if not a COW mapping */
+       if ((vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) != VM_MAYWRITE)
+               vma->vm_flags = (vma->vm_flags & ~VM_MIXEDMAP) | VM_PFNMAP;
+
        return 0;
 }