aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2013-07-31 19:59:57 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-08-05 13:04:09 -0400
commitfcb4a57805e04dee04f736c25a5648ec7bebe30f (patch)
tree083855e13320547eb0cd72dbef228b74a397fcb4
parenta70a3148b0c61cb7c588ea650db785b261b378a3 (diff)
drm/i915: Use bound list for inactive shrink
Do to the move active/inactive lists, it no longer makes sense to use them for shrinking, since shrinking isn't VM specific (such a need may also exist, but doesn't yet). What we can do instead is use the global bound list to find all objects which aren't active. Signed-off-by: Ben Widawsky <ben@bwidawsk.net> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 9e2d0f126be1..c9de97ac1d08 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4635,7 +4635,6 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
4635 struct drm_i915_private, 4635 struct drm_i915_private,
4636 mm.inactive_shrinker); 4636 mm.inactive_shrinker);
4637 struct drm_device *dev = dev_priv->dev; 4637 struct drm_device *dev = dev_priv->dev;
4638 struct i915_address_space *vm = &dev_priv->gtt.base;
4639 struct drm_i915_gem_object *obj; 4638 struct drm_i915_gem_object *obj;
4640 int nr_to_scan = sc->nr_to_scan; 4639 int nr_to_scan = sc->nr_to_scan;
4641 bool unlock = true; 4640 bool unlock = true;
@@ -4664,9 +4663,14 @@ i915_gem_inactive_shrink(struct shrinker *shrinker, struct shrink_control *sc)
4664 list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) 4663 list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list)
4665 if (obj->pages_pin_count == 0) 4664 if (obj->pages_pin_count == 0)
4666 cnt += obj->base.size >> PAGE_SHIFT; 4665 cnt += obj->base.size >> PAGE_SHIFT;
4667 list_for_each_entry(obj, &vm->inactive_list, mm_list) 4666
4667 list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
4668 if (obj->active)
4669 continue;
4670
4668 if (obj->pin_count == 0 && obj->pages_pin_count == 0) 4671 if (obj->pin_count == 0 && obj->pages_pin_count == 0)
4669 cnt += obj->base.size >> PAGE_SHIFT; 4672 cnt += obj->base.size >> PAGE_SHIFT;
4673 }
4670 4674
4671 if (unlock) 4675 if (unlock)
4672 mutex_unlock(&dev->struct_mutex); 4676 mutex_unlock(&dev->struct_mutex);