Commit 80dcfdbd authored by Ben Widawsky's avatar Ben Widawsky Committed by Daniel Vetter

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: default avatarBen Widawsky <ben@bwidawsk.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 0b02e798
...@@ -1707,9 +1707,14 @@ __i915_gem_shrink(struct drm_i915_private *dev_priv, long target, ...@@ -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) { 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 && if (!i915_gem_object_is_purgeable(obj) && purgeable_only)
i915_gem_object_put_pages(obj) == 0) { continue;
if (i915_gem_object_unbind(obj))
continue;
if (!i915_gem_object_put_pages(obj)) {
count += obj->base.size >> PAGE_SHIFT; count += obj->base.size >> PAGE_SHIFT;
if (count >= target) if (count >= target)
return count; return count;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment