]> www.infradead.org Git - users/willy/linux.git/commitdiff
xen/privcmd: Optimized privcmd_ioctl_mmap() by using vma_lookup()
authorLiam R. Howlett <Liam.Howlett@Oracle.com>
Thu, 8 Apr 2021 20:06:36 +0000 (16:06 -0400)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Wed, 20 Oct 2021 20:00:32 +0000 (16:00 -0400)
vma_lookup() walks the VMA tree for a specific value, find_vma() will
search the tree after walking to a specific value.  It is more efficient
to only walk to the requested value as this case requires the address to
equal the vm_start.

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
drivers/xen/privcmd.c

index 720a7b7abd46d690f2ed86f544064403ab4f1647..5f903ae9af7e8579145cc22ce1c54054398fb825 100644 (file)
@@ -282,7 +282,7 @@ static long privcmd_ioctl_mmap(struct file *file, void __user *udata)
                                                     struct page, lru);
                struct privcmd_mmap_entry *msg = page_address(page);
 
-               vma = find_vma(mm, msg->va);
+               vma = vma_lookup(mm, msg->va);
                rc = -EINVAL;
 
                if (!vma || (msg->va != vma->vm_start) || vma->vm_private_data)