drivers/virt: use get_user_pages_unlocked()
PATCH 1/1 drivers/virt: 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.
--- drivers/virt/fsl_hypervisor.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/virt/fsl_hypervisor.c +2 -5
@@ -243,11 +243,8 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) sg_list =PTR_ALIGN (sg_list_unaligned,sizeof (struct fh_sg_list ));/* Get the physical addresses of the source buffer */ -down_read (¤t->mm->mmap_sem); - num_pinned =get_user_pages (param.local_vaddr - lb_offset, - num_pages, (param.source ==-1 ) ?0 :FOLL_WRITE , - pages,NULL ); -up_read (¤t->mm->mmap_sem); + num_pinned =get_user_pages_unlocked (param.local_vaddr - lb_offset, + num_pages, pages, (param.source ==-1 ) ?0 :FOLL_WRITE );if (num_pinned != num_pages) {/* get_user_pages() failed */
Signature · 7 lines
2.10.2 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Just a gentle ping on this :) I think this might be a slightly abandoned corner of the kernel so not sure who else to ping to get this moving.
Quoted 29 lines · Lorenzo Stoakes
Moving from
get_user_pages()toget_user_pages_unlocked()simplifies the code and takes advantage ofVM_FAULT_RETRYfunctionality when faulting in pages.Signed-off-by Lorenzo Stoakes <[email protected]>--- drivers/virt/fsl_hypervisor.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/virt/fsl_hypervisor.c +2
-6@@ -243,11 +243,8 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) sg_list =PTR_ALIGN (sg_list_unaligned,sizeof (struct fh_sg_list ));/* Get the physical addresses of the source buffer */ -down_read (¤t->mm->mmap_sem); - num_pinned =get_user_pages (param.local_vaddr - lb_offset, - num_pages, (param.source ==-1 ) ?0 :FOLL_WRITE , - pages,NULL ); -up_read (¤t->mm->mmap_sem); + num_pinned =get_user_pages_unlocked (param.local_vaddr - lb_offset, + num_pages, pages, (param.source ==-1 ) ?0 :FOLL_WRITE );if (num_pinned != num_pages) {/* get_user_pages() failed */ --2.10.2
Signature · 8 lines
Lorenzo Stoakes https://ljs.io -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 3 lines · Lorenzo Stoakes
Just a gentle ping on this :) I think this might be a slightly abandoned corner of the kernel so not sure who else to ping to get this moving.
Maybe Andrew can pick it up?
http://lkml.kernel.org/r/[email protected]
Quoted 36 lines · Lorenzo Stoakes
Quoted 29 lines
Moving from
get_user_pages()toget_user_pages_unlocked()simplifies the code and takes advantage ofVM_FAULT_RETRYfunctionality when faulting in pages.Signed-off-by Lorenzo Stoakes <[email protected]>--- drivers/virt/fsl_hypervisor.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/virt/fsl_hypervisor.c +2
-6@@ -243,11 +243,8 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) sg_list =PTR_ALIGN (sg_list_unaligned,sizeof (struct fh_sg_list ));/* Get the physical addresses of the source buffer */ -down_read (¤t->mm->mmap_sem); - num_pinned =get_user_pages (param.local_vaddr - lb_offset, - num_pages, (param.source ==-1 ) ?0 :FOLL_WRITE , - pages,NULL ); -up_read (¤t->mm->mmap_sem); + num_pinned =get_user_pages_unlocked (param.local_vaddr - lb_offset, + num_pages, pages, (param.source ==-1 ) ?0 :FOLL_WRITE );if (num_pinned != num_pages) {/* get_user_pages() failed */ --2.10.2
Signature · 2 lines
Lorenzo Stoakes https://ljs.io
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · Michal Hocko
Quoted 3 lines · Lorenzo Stoakes
Just a gentle ping on this :) I think this might be a slightly abandoned corner of the kernel so not sure who else to ping to get this moving.
Maybe Andrew can pick it up?
http://lkml.kernel.org/r/[email protected]
Hi all, since the merge window has opened thought I'd give another gentle nudge on this - Andrew, are you ok to pick this up? For convenience the raw patch is at
https://marc.info/?l=linux-mm&m=147802941732512&q=raw I've checked and it still applies. Let me know if you want me to simply resend this or if there is anything else I can do to nudge this along!
Thanks, Lorenzo
Quoted 40 lines
Quoted 25 lines · Lorenzo Stoakes
Quoted 24 lines
Moving from
get_user_pages()toget_user_pages_unlocked()simplifies the code and takes advantage ofVM_FAULT_RETRYfunctionality when faulting in pages.Signed-off-by Lorenzo Stoakes <[email protected]>--- drivers/virt/fsl_hypervisor.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)drivers/virt/fsl_hypervisor.c +2
-5@@ -243,11 +243,8 @@ static long ioctl_memcpy(struct fsl_hv_ioctl_memcpy __user *p) sg_list =PTR_ALIGN (sg_list_unaligned,sizeof (struct fh_sg_list ));/* Get the physical addresses of the source buffer */ -down_read (¤t->mm->mmap_sem); - num_pinned =get_user_pages (param.local_vaddr - lb_offset, - num_pages, (param.source ==-1 ) ?0 :FOLL_WRITE , - pages,NULL ); -up_read (¤t->mm->mmap_sem); + num_pinned =get_user_pages_unlocked (param.local_vaddr - lb_offset, + num_pages, pages, (param.source ==-1 ) ?0 :FOLL_WRITE );Quoted 11 lines
Quoted 5 lines
drivers/virt/fsl_hypervisor.c +0
-1if (num_pinned != num_pages) {/* get_user_pages() failed */ --2.10.2
--
Lorenzo Stoakes
https://ljs.io--
Michal Hocko
SUSE Labs
Signature · 8 lines
Lorenzo Stoakes https://ljs.io -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>