Commit 3ab7c086 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

locking/drm: Kill mutex trickery

Poking at lock internals is not cool. Since I'm going to change the
implementation this will break, take it out.
Tested-by: default avatarJason Low <jason.low2@hpe.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 9fe68cad
...@@ -35,19 +35,6 @@ ...@@ -35,19 +35,6 @@
#include "i915_drv.h" #include "i915_drv.h"
#include "i915_trace.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 bool any_vma_pinned(struct drm_i915_gem_object *obj) static bool any_vma_pinned(struct drm_i915_gem_object *obj)
{ {
struct i915_vma *vma; struct i915_vma *vma;
...@@ -240,13 +227,8 @@ unsigned long i915_gem_shrink_all(struct drm_i915_private *dev_priv) ...@@ -240,13 +227,8 @@ unsigned long i915_gem_shrink_all(struct drm_i915_private *dev_priv)
static bool i915_gem_shrinker_lock(struct drm_device *dev, bool *unlock) static bool i915_gem_shrinker_lock(struct drm_device *dev, bool *unlock)
{ {
if (!mutex_trylock(&dev->struct_mutex)) { if (!mutex_trylock(&dev->struct_mutex))
if (!mutex_is_locked_by(&dev->struct_mutex, current))
return false;
*unlock = false; *unlock = false;
} else
*unlock = true;
return true; return true;
} }
......
...@@ -18,29 +18,12 @@ ...@@ -18,29 +18,12 @@
#include "msm_drv.h" #include "msm_drv.h"
#include "msm_gem.h" #include "msm_gem.h"
static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task)
{
if (!mutex_is_locked(mutex))
return false;
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_MUTEXES)
return mutex->owner == task;
#else
/* Since UP may be pre-empted, we cannot assume that we own the lock */
return false;
#endif
}
static bool msm_gem_shrinker_lock(struct drm_device *dev, bool *unlock) static bool msm_gem_shrinker_lock(struct drm_device *dev, bool *unlock)
{ {
if (!mutex_trylock(&dev->struct_mutex)) { if (!mutex_trylock(&dev->struct_mutex))
if (!mutex_is_locked_by(&dev->struct_mutex, current))
return false; return false;
*unlock = false;
} else {
*unlock = true;
}
*unlock = true;
return true; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment