All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Wait for struct_mutex inside shrinker
@ 2017-05-24 10:11 Chris Wilson
  2017-05-24 10:30 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-05-29 11:55 ` [PATCH] " Joonas Lahtinen
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2017-05-24 10:11 UTC (permalink / raw)
  To: intel-gfx

Having resolved whether or not we would deadlock upon a call to
mutex_lock(&dev->struct_mutex), we can then wait for the contended
struct_mutex if we are not the owner. This should significantly improve
the chance of running the shrinker for other processes whilst the GPU is
busy.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index b409e67c5c72..03e08e1853e6 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -39,8 +39,8 @@ static bool shrinker_lock(struct drm_i915_private *dev_priv, bool *unlock)
 {
 	switch (mutex_trylock_recursive(&dev_priv->drm.struct_mutex)) {
 	case MUTEX_TRYLOCK_FAILED:
-		return false;
-
+		if (mutex_lock_killable(&dev_priv->drm.struct_mutex))
+			return false;
 	case MUTEX_TRYLOCK_SUCCESS:
 		*unlock = true;
 		return true;
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-29 11:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-24 10:11 [PATCH] drm/i915: Wait for struct_mutex inside shrinker Chris Wilson
2017-05-24 10:30 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-05-29 11:55 ` [PATCH] " Joonas Lahtinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.