From: Chris Wilson <chris@chris-wilson.co.uk>
To: akash.goel@intel.com
Cc: intel-gfx@lists.freedesktop.org, Hugh Dickins <hughd@google.com>,
linux-mm@kvack.org, Sourab Gupta <sourab.gupta@intel.com>
Subject: Re: [PATCH v2 2/2] drm/i915: Make pages of GFX allocations movable
Date: Thu, 24 Mar 2016 18:40:00 +0000 [thread overview]
Message-ID: <20160324184000.GW27742@nuc-i3427.alporthouse.com> (raw)
In-Reply-To: <1458843779-27904-1-git-send-email-akash.goel@intel.com>
On Thu, Mar 24, 2016 at 11:52:59PM +0530, akash.goel@intel.com wrote:
> +static int
> +unsafe_drop_pages(struct drm_i915_gem_object *obj)
> +{
> + struct i915_vma *vma, *next;
> + int ret;
> +
> + drm_gem_object_reference(&obj->base);
> + list_for_each_entry_safe(vma, next, &obj->vma_list, obj_link)
> + if (i915_vma_unbind(vma))
> + break;
> +
> + ret = i915_gem_object_put_pages(obj);
> + drm_gem_object_unreference(&obj->base);
> +
> + return ret;
> +}
> +
> +static int
> +do_migrate_page(struct drm_i915_gem_object *obj)
> +{
> + struct drm_i915_private *dev_priv = obj->base.dev->dev_private;
> + int ret = 0;
> +
> + if (!can_migrate_page(obj))
> + return -EBUSY;
> +
> + /* HW access would be required for a bound object for which
> + * device has to be kept runtime active. But a deadlock scenario
> + * can arise if the attempt is made to resume the device, when
> + * either a suspend or a resume operation is already happening
> + * concurrently from some other path and that only actually
> + * triggered the compaction. So only unbind if the device is
> + * currently runtime active.
> + */
> + if (!intel_runtime_pm_get_if_in_use(dev_priv))
> + return -EBUSY;
> +
> + if (!unsafe_drop_pages(obj))
> + ret = -EBUSY;
Reversed!
> +
> + intel_runtime_pm_put(dev_priv);
> + return ret;
> +}
> +
> /**
> * i915_gem_shrink - Shrink buffer object caches
> * @dev_priv: i915 device
> @@ -156,7 +222,6 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
> INIT_LIST_HEAD(&still_in_list);
> while (count < target && !list_empty(phase->list)) {
> struct drm_i915_gem_object *obj;
> - struct i915_vma *vma, *v;
>
> obj = list_first_entry(phase->list,
> typeof(*obj), global_list);
> @@ -172,18 +237,8 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
> if (!can_release_pages(obj))
> continue;
>
> - drm_gem_object_reference(&obj->base);
> -
> - /* For the unbound phase, this should be a no-op! */
> - list_for_each_entry_safe(vma, v,
> - &obj->vma_list, obj_link)
> - if (i915_vma_unbind(vma))
> - break;
> -
> - if (i915_gem_object_put_pages(obj) == 0)
> + if (unsafe_drop_pages(obj) == 0)
> count += obj->base.size >> PAGE_SHIFT;
But correct here :)
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2016-03-24 18:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-23 6:09 [PATCH 1/2] shmem: Support for registration of Driver/file owner specific ops akash.goel
2016-03-23 6:09 ` [PATCH 2/2] drm/i915: Make pages of GFX allocations movable akash.goel
2016-03-23 7:58 ` Chris Wilson
2016-03-23 8:25 ` Goel, Akash
2016-03-24 8:13 ` Chris Wilson
2016-03-24 18:22 ` [PATCH v2 " akash.goel
2016-03-24 18:40 ` Chris Wilson [this message]
2016-04-04 11:27 ` [PATCH v3 " akash.goel
2016-03-24 12:11 ` [Intel-gfx] [PATCH 1/2] shmem: Support for registration of Driver/file owner specific ops Joonas Lahtinen
2016-10-19 15:11 ` akash goel
2016-10-20 15:15 ` Joonas Lahtinen
2016-11-04 12:48 ` [PATCH 1/2] shmem: Support for registration of driver/file " akash.goel
2016-11-04 12:48 ` [PATCH 2/2] drm/i915: Make GPU pages movable akash.goel
2016-11-04 13:37 ` Chris Wilson
2016-11-04 13:53 ` Goel, Akash
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=20160324184000.GW27742@nuc-i3427.alporthouse.com \
--to=chris@chris-wilson.co.uk \
--cc=akash.goel@intel.com \
--cc=hughd@google.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linux-mm@kvack.org \
--cc=sourab.gupta@intel.com \
/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