From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 6/6] drm/i915: Avoid allocating a vmap arena for a single page
Date: Mon, 11 Apr 2016 15:40:15 +0100 [thread overview]
Message-ID: <570BB74F.1010405@linux.intel.com> (raw)
In-Reply-To: <1460113874-17366-7-git-send-email-chris@chris-wilson.co.uk>
On 08/04/16 12:11, Chris Wilson wrote:
> If we want a contiguous mapping of a single page sized object, we can
> forgo using vmap() and just use a regular kmap(). Note that this is only
> suitable if the desired pgprot_t is compatible.
>
> v2: Use is_vmalloc_addr()
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Cc: Dave Gordon <david.s.gordon@intel.com>
> ---
> drivers/gpu/drm/i915/i915_gem.c | 19 ++++++++++++++-----
> 1 file changed, 14 insertions(+), 5 deletions(-)
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Regards,
Tvrtko
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index fa810226bd8b..b37ffea8b458 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -2233,7 +2233,10 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj)
> list_del(&obj->global_list);
>
> if (obj->mapping) {
> - vunmap(obj->mapping);
> + if (is_vmalloc_addr(obj->mapping))
> + vunmap(obj->mapping);
> + else
> + kunmap(kmap_to_page(obj->mapping));
> obj->mapping = NULL;
> }
>
> @@ -2418,13 +2421,19 @@ void *i915_gem_object_pin_map(struct drm_i915_gem_object *obj)
> i915_gem_object_pin_pages(obj);
>
> if (obj->mapping == NULL) {
> - struct sg_page_iter sg_iter;
> struct page **pages;
> - int n;
>
> - n = obj->base.size >> PAGE_SHIFT;
> - pages = drm_malloc_gfp(n, sizeof(*pages), GFP_TEMPORARY);
> + pages = NULL;
> + if (obj->base.size == PAGE_SIZE)
> + obj->mapping = kmap(sg_page(obj->pages->sgl));
> + else
> + pages = drm_malloc_gfp(obj->base.size >> PAGE_SHIFT,
> + sizeof(*pages),
> + GFP_TEMPORARY);
> if (pages != NULL) {
> + struct sg_page_iter sg_iter;
> + int n;
> +
> n = 0;
> for_each_sg_page(obj->pages->sgl, &sg_iter,
> obj->pages->nents, 0)
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2016-04-11 14:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 11:11 vmap consolidation to obj->mapping Chris Wilson
2016-04-08 11:11 ` [PATCH v2 1/6] drm/i915/dmabuf: Tighten struct_mutex for unmap_dma_buf Chris Wilson
2016-04-08 11:11 ` [PATCH v2 2/6] drm/i915: Consolidate common error handling in intel_pin_and_map_ringbuffer_obj Chris Wilson
2016-04-08 11:11 ` [PATCH v2 3/6] drm/i915: Refactor duplicate object vmap functions Chris Wilson
2016-04-11 14:20 ` Tvrtko Ursulin
2016-04-08 11:11 ` [PATCH v2 4/6] drm/i915/shrinker: Restrict vmap purge to objects with vmaps Chris Wilson
2016-04-11 14:25 ` Tvrtko Ursulin
2016-04-11 14:44 ` Chris Wilson
2016-04-11 14:57 ` Tvrtko Ursulin
2016-04-11 16:40 ` Chris Wilson
2016-04-12 7:31 ` Dave Gordon
2016-04-08 11:11 ` [PATCH v2 5/6] drm,i915: Introduce drm_malloc_gfp() Chris Wilson
2016-04-08 11:11 ` [PATCH v2 6/6] drm/i915: Avoid allocating a vmap arena for a single page Chris Wilson
2016-04-11 14:40 ` Tvrtko Ursulin [this message]
2016-04-08 12:27 ` ✗ Fi.CI.BAT: warning for series starting with [v2,1/6] drm/i915/dmabuf: Tighten struct_mutex for unmap_dma_buf Patchwork
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=570BB74F.1010405@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).