From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/userptr: Replace get_user_pages()
Date: Thu, 17 Mar 2016 10:09:28 +0000 [thread overview]
Message-ID: <56EA8258.9040404@linux.intel.com> (raw)
In-Reply-To: <1458207434-13530-1-git-send-email-chris@chris-wilson.co.uk>
On 17/03/16 09:37, Chris Wilson wrote:
> Although the long term future of get_user_pages_locked() itself is
> doubtful, the kernel currently recommends:
>
> /* get_user_pages should be phased out in favor of
> * get_user_pages_locked|unlocked or get_user_pages_fast. Nothing
> * should use get_user_pages because it cannot pass
> * FAULT_FLAG_ALLOW_RETRY to handle_mm_fault.
> */
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
> drivers/gpu/drm/i915/i915_gem_userptr.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_userptr.c b/drivers/gpu/drm/i915/i915_gem_userptr.c
> index 54088a4d6498..fa7d8a8b66ef 100644
> --- a/drivers/gpu/drm/i915/i915_gem_userptr.c
> +++ b/drivers/gpu/drm/i915/i915_gem_userptr.c
> @@ -500,20 +500,22 @@ __i915_gem_userptr_get_pages_worker(struct work_struct *_work)
> pvec = drm_malloc_ab(npages, sizeof(struct page *));
> if (pvec != NULL) {
> struct mm_struct *mm = obj->userptr.mm->mm;
> + int locked = 1;
>
> down_read(&mm->mmap_sem);
> while (pinned < npages) {
> - ret = get_user_pages(work->task, mm,
> - obj->userptr.ptr + pinned * PAGE_SIZE,
> - npages - pinned,
> - !obj->userptr.read_only, 0,
> - pvec + pinned, NULL);
> + ret = get_user_pages_locked(work->task, mm,
> + obj->userptr.ptr + pinned * PAGE_SIZE,
> + npages - pinned,
> + !obj->userptr.read_only, 0,
> + pvec + pinned, &locked);
> if (ret < 0)
> break;
>
> pinned += ret;
> }
> - up_read(&mm->mmap_sem);
> + if (locked)
> + up_read(&mm->mmap_sem);
> }
>
> mutex_lock(&dev->struct_mutex);
>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Is it just cleanup or actually improves some real (as in hit by someone)
scenario?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-03-17 10:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 9:37 [PATCH] drm/i915/userptr: Replace get_user_pages() Chris Wilson
2016-03-17 10:09 ` Tvrtko Ursulin [this message]
2016-03-17 10:20 ` Chris Wilson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56EA8258.9040404@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.