浏览代码

drm/i915: Decouple the object from the unbound list before freeing pages

As we may actually allocate in order to save the physical swizzling bits
during the free, we have to be careful not to trigger the shrinker on
the same object.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
[danvet: Added a small comment in the code to really drive the
scariness of this patch home.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Chris Wilson 12 年之前
父节点
当前提交
a2165e3123
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      drivers/gpu/drm/i915/i915_gem.c

+ 5 - 1
drivers/gpu/drm/i915/i915_gem.c

@@ -1696,10 +1696,14 @@ i915_gem_object_put_pages(struct drm_i915_gem_object *obj)
 	if (obj->pages_pin_count)
 	if (obj->pages_pin_count)
 		return -EBUSY;
 		return -EBUSY;
 
 
+	/* ->put_pages might need to allocate memory for the bit17 swizzle
+	 * array, hence protect them from being reaped by removing them from gtt
+	 * lists early. */
+	list_del(&obj->gtt_list);
+
 	ops->put_pages(obj);
 	ops->put_pages(obj);
 	obj->pages = NULL;
 	obj->pages = NULL;
 
 
-	list_del(&obj->gtt_list);
 	if (i915_gem_object_is_purgeable(obj))
 	if (i915_gem_object_is_purgeable(obj))
 		i915_gem_object_truncate(obj);
 		i915_gem_object_truncate(obj);