All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Intel-gfx@lists.freedesktop.org
Subject: [RFC 4/4] drm/i915: Remove trylock-looping from the shrinker
Date: Thu,  3 Jan 2019 12:23:29 +0000	[thread overview]
Message-ID: <20190103122329.19948-5-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20190103122329.19948-1-tvrtko.ursulin@linux.intel.com>

From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

In a patch named "drm/i915: Return immediately if trylock fails for
direct-reclaim" Chris Wilson implicitly suggests it is safe to use a plain
mutex_lock instead of trylock on the I915_SHRINK_ACTIVE code paths.

Explore this to see how the lockdep traces will look.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index 97deec775f40..2d4a54851c0a 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -47,15 +47,8 @@ shrinker_lock(struct drm_i915_private *i915, unsigned int flags, bool *unlock)
 	case MUTEX_TRYLOCK_FAILED:
 		*unlock = false;
 		if (flags & I915_SHRINK_ACTIVE) {
-			preempt_disable();
-			do {
-				cpu_relax();
-				if (mutex_trylock(&i915->drm.struct_mutex)) {
-					*unlock = true;
-					break;
-				}
-			} while (!need_resched());
-			preempt_enable();
+			mutex_lock(&i915->drm.struct_mutex);
+			*unlock = true;
 		}
 		return *unlock;
 
-- 
2.19.1

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

  parent reply	other threads:[~2019-01-03 12:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 12:23 [RFC 0/4] Shrinker tweaks/fixes? Tvrtko Ursulin
2019-01-03 12:23 ` [RFC 1/4] drm/i915: Reduce recursive mutex locking from the shrinker Tvrtko Ursulin
2019-01-03 12:29   ` Chris Wilson
2019-01-03 13:09     ` Tvrtko Ursulin
2019-01-03 12:23 ` [RFC 2/4] drm/i915: Fix timeout handling in i915_gem_shrinker_vmap Tvrtko Ursulin
2019-01-03 12:23 ` [RFC 3/4] drm/i915: Return immediately if trylock fails for direct-reclaim Tvrtko Ursulin
2019-01-03 12:23 ` Tvrtko Ursulin [this message]
2019-01-03 12:56   ` [RFC 4/4] drm/i915: Remove trylock-looping from the shrinker Chris Wilson
2019-01-03 13:10     ` Tvrtko Ursulin
2019-01-03 12:45 ` ✗ Fi.CI.CHECKPATCH: warning for Shrinker tweaks/fixes? Patchwork
2019-01-03 12:47 ` ✗ Fi.CI.SPARSE: " Patchwork
2019-01-03 13:06 ` ✓ Fi.CI.BAT: success " Patchwork
2019-01-03 14:54 ` ✗ Fi.CI.IGT: failure " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190103122329.19948-5-tvrtko.ursulin@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.