Skip to content

Commit 3d88936

Browse files
lorenzo-stoakestorvalds
authored andcommitted
drivers/virt/fsl_hypervisor.c: use get_user_pages_unlocked()
Moving from get_user_pages() to get_user_pages_unlocked() simplifies the code and takes advantage of VM_FAULT_RETRY functionality when faulting in pages. Link: http://lkml.kernel.org/r/20161101194332.23961-1-lstoakes@gmail.com Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com> Cc: Michal Hocko <mhocko@kernel.org> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Kumar Gala <galak@kernel.crashing.org> Cc: Mihai Caraman <mihai.caraman@freescale.com> Cc: Greg KH <gregkh@linuxfoundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6325945 commit 3d88936

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/virt/fsl_hypervisor.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,11 +243,8 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p)
243243
sg_list = PTR_ALIGN(sg_list_unaligned, sizeof(struct fh_sg_list));
244244

245245
/* Get the physical addresses of the source buffer */
246-
down_read(&current->mm->mmap_sem);
247-
num_pinned = get_user_pages(param.local_vaddr - lb_offset,
248-
num_pages, (param.source == -1) ? 0 : FOLL_WRITE,
249-
pages, NULL);
250-
up_read(&current->mm->mmap_sem);
246+
num_pinned = get_user_pages_unlocked(param.local_vaddr - lb_offset,
247+
num_pages, pages, (param.source == -1) ? 0 : FOLL_WRITE);
251248

252249
if (num_pinned != num_pages) {
253250
/* get_user_pages() failed */

0 commit comments

Comments
 (0)