[PATCH 6/7] drm/i915: Convert to use get_user_page_unlocked()
Jan Kara
jack at suse.com
Tue Oct 6 02:24:29 PDT 2015
From: Jan Kara <jack at suse.cz>
Convert __i915_gem_userptr_get_pages_worker() to use
get_user_page_unlocked() so that we don't unnecessarily leak knowledge of
mm locking into driver code.
CC: Daniel Vetter <daniel.vetter at intel.com>
CC: David Airlie <airlied at linux.ie>
CC: dri-devel at lists.freedesktop.org
Signed-off-by: Jan Kara <jack at suse.cz>
---
drivers/gpu/drm/i915/i915_gem_userptr.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
index 8fd431bcdfd3..5138fe61d2fa 100644
--- a/drivers/gpu/drm/i915/i915_gem_userptr.c
+++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
@@ -585,19 +585,18 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
if (pvec != NULL) {
struct mm_struct *mm = obj->userptr.mm->mm;
- down_read(&mm->mmap_sem);
while (pinned < num_pages) {
- ret = get_user_pages(work->task, mm,
- obj->userptr.ptr + pinned * PAGE_SIZE,
- num_pages - pinned,
- !obj->userptr.read_only, 0,
- pvec + pinned, NULL);
+ ret = get_user_pages_unlocked(
+ work->task, mm,
+ obj->userptr.ptr + pinned * PAGE_SIZE,
+ num_pages - pinned,
+ !obj->userptr.read_only, 0,
+ pvec + pinned);
if (ret < 0)
break;
pinned += ret;
}
- up_read(&mm->mmap_sem);
}
mutex_lock(&dev->struct_mutex);
--
2.1.4
More information about the dri-devel
mailing list