summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_gem.c
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2013-07-31 17:00:01 -0700
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-08 14:02:41 +0200
commit80dcfdbd68b094f21f7ce222fb8039123f5b4cbe (patch)
tree9490aafd5e0f6852d15a6b9e2d47c6a02c0618db /drivers/gpu/drm/i915/i915_gem.c
parent0b02e798ffec99b51f2fe931ceb61ca0d22d2a70 (diff)
downloadblackbird-op-linux-80dcfdbd68b094f21f7ce222fb8039123f5b4cbe.tar.gz
blackbird-op-linux-80dcfdbd68b094f21f7ce222fb8039123f5b4cbe.zip
drm/i915: Rework __i915_gem_shrink
In order to do this for all VMs, it's convenient to rework the logic a bit. This should have no functional impact. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem.c')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 3debb35b7195..4ca8f9fad913 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1707,9 +1707,14 @@ __i915_gem_shrink(struct drm_i915_private *dev_priv, long target,
}
list_for_each_entry_safe(obj, next, &vm->inactive_list, mm_list) {
- if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) &&
- i915_gem_object_unbind(obj) == 0 &&
- i915_gem_object_put_pages(obj) == 0) {
+
+ if (!i915_gem_object_is_purgeable(obj) && purgeable_only)
+ continue;
+
+ if (i915_gem_object_unbind(obj))
+ continue;
+
+ if (!i915_gem_object_put_pages(obj)) {
count += obj->base.size >> PAGE_SHIFT;
if (count >= target)
return count;
OpenPOWER on IntegriCloud