[PATCH 3/3] drm/i915: Mark up i915_active as safe for use inside shrinkers
Chris Wilson
chris at chris-wilson.co.uk
Sat Jun 29 10:03:10 UTC 2019
Since a shrinker may be forced to wait on GPU activity,
i915_active_wait() must be safe for use inside a shrinker, and so let's
mark up the lock as being acquired by the shrinker to avoid any nasty
surprises creeping in.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_active.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index a55a0a954d74..fa6220456ac3 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -203,6 +203,11 @@ void __i915_active_init(struct drm_i915_private *i915,
init_llist_head(&ref->barriers);
atomic_set(&ref->count, 0);
__mutex_init(&ref->mutex, "i915_active", key);
+
+ /* Declare ourselves safe for use inside shrinkers */
+ fs_reclaim_acquire(GFP_KERNEL);
+ might_lock(&ref->mutex);
+ fs_reclaim_release(GFP_KERNEL);
}
int i915_active_ref(struct i915_active *ref,
--
2.20.1
More information about the Intel-gfx-trybot
mailing list