From: Peter Zijlstra <peterz@infradead.org>
To: Linus Torvalds <torvalds@linux-foundation.org>,
Waiman Long <waiman.long@hpe.com>, Jason Low <jason.low2@hpe.com>,
Ding Tianhong <dingtianhong@huawei.com>,
Thomas Gleixner <tglx@linutronix.de>,
Will Deacon <Will.Deacon@arm.com>, Ingo Molnar <mingo@redhat.com>,
Imre Deak <imre.deak@intel.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Tim Chen <tim.c.chen@linux.intel.com>,
Terry Rudd <terry.rudd@hpe.com>,
"Paul E. McKenney" <paulmck@us.ibm.com>,
Jason Low <jason.low2@hp.com>,
Peter Zijlstra <peterz@infradead.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>,
Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [RFC][PATCH -v2 1/4] locking/drm/i915: Kill mutex trickery
Date: Thu, 25 Aug 2016 20:37:35 +0200 [thread overview]
Message-ID: <20160825184324.713134633@infradead.org> (raw)
In-Reply-To: <20160825183734.113736626@infradead.org>
[-- Attachment #1: peterz-revert-drm-i915-brainmelt.patch --]
[-- Type: text/plain, Size: 1470 bytes --]
Poking at lock internals is not cool. Since I'm going to change the
implementation this will break, take it out.
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
drivers/gpu/drm/i915/i915_gem_shrinker.c | 26 +++-----------------------
1 file changed, 3 insertions(+), 23 deletions(-)
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -35,19 +35,6 @@
#include "i915_drv.h"
#include "i915_trace.h"
-static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task)
-{
- if (!mutex_is_locked(mutex))
- return false;
-
-#if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_MUTEX_SPIN_ON_OWNER)
- return mutex->owner == task;
-#else
- /* Since UP may be pre-empted, we cannot assume that we own the lock */
- return false;
-#endif
-}
-
static int num_vma_bound(struct drm_i915_gem_object *obj)
{
struct i915_vma *vma;
@@ -238,17 +225,10 @@ unsigned long i915_gem_shrink_all(struct
static bool i915_gem_shrinker_lock(struct drm_device *dev, bool *unlock)
{
- if (!mutex_trylock(&dev->struct_mutex)) {
- if (!mutex_is_locked_by(&dev->struct_mutex, current))
- return false;
-
- if (to_i915(dev)->mm.shrinker_no_lock_stealing)
- return false;
-
- *unlock = false;
- } else
- *unlock = true;
+ if (!mutex_trylock(&dev->struct_mutex))
+ return false;
+ *unlock = true;
return true;
}
next prev parent reply other threads:[~2016-08-25 18:46 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-25 18:37 [RFC][PATCH -v2 0/4] locking/mutex: Rewrite basic mutex Peter Zijlstra
2016-08-25 18:37 ` Peter Zijlstra [this message]
2016-08-25 19:36 ` [RFC][PATCH -v2 1/4] locking/drm/i915: Kill mutex trickery Daniel Vetter
2016-08-25 19:59 ` Waiman Long
2016-08-25 18:37 ` [RFC][PATCH -v2 2/4] locking/mutex: Rework mutex::owner Peter Zijlstra
2016-08-25 18:37 ` [RFC][PATCH -v2 3/4] locking/mutex: Allow MUTEX_SPIN_ON_OWNER when DEBUG_MUTEXES Peter Zijlstra
2016-08-25 18:37 ` [RFC][PATCH -v2 4/4] locking/mutex: Add lock handoff to avoid starvation Peter Zijlstra
2016-08-25 22:00 ` Waiman Long
2016-08-25 22:23 ` Peter Zijlstra
2016-08-26 14:30 ` Waiman Long
2016-08-26 15:18 ` Peter Zijlstra
2016-08-26 23:40 ` Waiman Long
2016-08-29 15:41 ` Peter Zijlstra
2016-08-30 11:53 ` Peter Zijlstra
2016-08-30 22:32 ` Waiman Long
2016-08-26 3:25 [RFC][PATCH -v2 1/4] locking/drm/i915: Kill mutex trickery Andreas Mohr
2016-08-26 9:10 ` Peter Zijlstra
2016-08-26 14:33 ` Waiman Long
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=20160825184324.713134633@infradead.org \
--to=peterz@infradead.org \
--cc=Will.Deacon@arm.com \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@ffwll.ch \
--cc=dave@stgolabs.net \
--cc=dingtianhong@huawei.com \
--cc=imre.deak@intel.com \
--cc=jason.low2@hp.com \
--cc=jason.low2@hpe.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@us.ibm.com \
--cc=terry.rudd@hpe.com \
--cc=tglx@linutronix.de \
--cc=tim.c.chen@linux.intel.com \
--cc=torvalds@linux-foundation.org \
--cc=waiman.long@hpe.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®