path: root/virt/kvm/async_pf.c
diff options
authorLorenzo Stoakes <>2016-12-14 15:06:55 -0800
committerLinus Torvalds <>2016-12-14 16:04:09 -0800
commit8b7457ef9a9eb46cd1675d40d8e1fd3c47a38395 (patch)
tree485def76ab013b2609eb24762e4c39fc531c72d7 /virt/kvm/async_pf.c
parent5b56d49fc31dbb0487e14ead790fc81ca9fb2c99 (diff)
mm: unexport __get_user_pages_unlocked()
Unexport the low-level __get_user_pages_unlocked() function and replaces invocations with calls to more appropriate higher-level functions. In hva_to_pfn_slow() we are able to replace __get_user_pages_unlocked() with get_user_pages_unlocked() since we can now pass gup_flags. In async_pf_execute() and process_vm_rw_single_vec() we need to pass different tsk, mm arguments so get_user_pages_remote() is the sane replacement in these cases (having added manual acquisition and release of mmap_sem.) Additionally get_user_pages_remote() reintroduces use of the FOLL_TOUCH flag. However, this flag was originally silently dropped by commit 1e9877902dc7 ("mm/gup: Introduce get_user_pages_remote()"), so this appears to have been unintentional and reintroducing it is therefore not an issue. [ coding-style fixes] Link: Signed-off-by: Lorenzo Stoakes <> Acked-by: Michal Hocko <> Cc: Jan Kara <> Cc: Hugh Dickins <> Cc: Dave Hansen <> Cc: Rik van Riel <> Cc: Mel Gorman <> Cc: Paolo Bonzini <> Cc: Radim Krcmar <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'virt/kvm/async_pf.c')
1 files changed, 7 insertions, 3 deletions
diff --git a/virt/kvm/async_pf.c b/virt/kvm/async_pf.c
index efeceb0a222d..3815e940fbea 100644
--- a/virt/kvm/async_pf.c
+++ b/virt/kvm/async_pf.c
@@ -76,16 +76,20 @@ static void async_pf_execute(struct work_struct *work)
struct kvm_vcpu *vcpu = apf->vcpu;
unsigned long addr = apf->addr;
gva_t gva = apf->gva;
+ int locked = 1;
* This work is run asynchromously to the task which owns
* mm and might be done in another context, so we must
- * use FOLL_REMOTE.
+ * access remotely.
- __get_user_pages_unlocked(NULL, mm, addr, 1, NULL,
+ down_read(&mm->mmap_sem);
+ get_user_pages_remote(NULL, mm, addr, 1, FOLL_WRITE, NULL, NULL,
+ &locked);
+ if (locked)
+ up_read(&mm->mmap_sem);
kvm_async_page_present_sync(vcpu, apf);