All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/5] drm/i915: Wait for struct_mutex inside shrinker
@ 2017-05-24 14:39 Chris Wilson
  2017-05-24 14:39 ` [PATCH v2 2/5] drm/i915: Allow kswapd to pause the device whilst reaping Chris Wilson
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Chris Wilson @ 2017-05-24 14:39 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] 10+ messages in thread

end of thread, other threads:[~2017-05-24 15:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-24 14:39 [PATCH v2 1/5] drm/i915: Wait for struct_mutex inside shrinker Chris Wilson
2017-05-24 14:39 ` [PATCH v2 2/5] drm/i915: Allow kswapd to pause the device whilst reaping Chris Wilson
2017-05-24 14:39 ` [PATCH v2 3/5] drm/i915: Encourage our shrinker more when our shmemfs allocations fails Chris Wilson
2017-05-24 14:39 ` [PATCH v2 4/5] drm/i915: Remove __GFP_NORETRY from our buffer allocator Chris Wilson
2017-05-24 14:39 ` [PATCH v2 5/5] drm/i915: Revoke any shmemfs mappings on shrinking Chris Wilson
2017-05-24 14:55 ` [PATCH v2 1/5] drm/i915: Wait for struct_mutex inside shrinker Chris Wilson
2017-05-24 15:31   ` Joonas Lahtinen
2017-05-24 15:38     ` Chris Wilson
2017-05-24 14:57 ` ✓ Fi.CI.BAT: success for series starting with [v2,1/5] " Patchwork
2017-05-24 15:08   ` Chris Wilson

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.