From: Liam R. Howlett Date: Tue, 6 Sep 2022 19:48:49 +0000 (+0000) Subject: xen: use vma_lookup() in privcmd_ioctl_mmap() X-Git-Tag: v6.1-rc5~170^2~376 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7ccf089b262be2c7f2cdc6c08412a1939a812102;p=platform%2Fkernel%2Flinux-starfive.git xen: use vma_lookup() in privcmd_ioctl_mmap() 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 since privcmd_ioctl_mmap() will exit the loop if vm_start != msg->va. Link: https://lkml.kernel.org/r/20220906194824.2110408-20-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett Acked-by: Vlastimil Babka Tested-by: Yu Zhao Cc: Catalin Marinas Cc: David Hildenbrand Cc: David Howells Cc: Davidlohr Bueso Cc: "Matthew Wilcox (Oracle)" Cc: SeongJae Park Cc: Sven Schnelle Cc: Will Deacon Signed-off-by: Andrew Morton --- diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index e88e8f6..fae50a2 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -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)