[PATCH 25/25] vm-vs-fs

Chris Wilson chris at chris-wilson.co.uk
Fri Jun 22 10:49:16 UTC 2018


---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 28cb8911d273..a1bd722b86f7 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -28,6 +28,7 @@
 #include <linux/fault-inject.h>
 #include <linux/log2.h>
 #include <linux/random.h>
+#include <linux/sched/mm.h>
 #include <linux/seq_file.h>
 #include <linux/stop_machine.h>
 
@@ -2116,6 +2117,18 @@ static void i915_address_space_init(struct i915_address_space *vm,
 
 	list_add_tail(&vm->global_link, &dev_priv->vm_list);
 	pagevec_init(&vm->free_pages);
+
+	/*
+	 * The vm->mutex must be reclaim safe (for use in the shrinker).
+	 * Do a dummy acquire now under fs_reclaim so that any allocation
+	 * attempt holding the lock is immediately reported by lockdep.
+	 */
+	if (IS_ENABLED(CONFIG_LOCKDEP)) {
+		fs_reclaim_acquire(GFP_KERNEL);
+		mutex_lock(&vm->mutex);
+		mutex_unlock(&vm->mutex);
+		fs_reclaim_release(GFP_KERNEL);
+	}
 }
 
 static void i915_address_space_fini(struct i915_address_space *vm)
-- 
2.18.0.rc2



More information about the Intel-gfx-trybot mailing list