M: Daniel Vetter <daniel.vetter@intel.com>
M: Jani Nikula <jani.nikula@linux.intel.com>
L: intel-gfx@lists.freedesktop.org
- L: dri-devel@lists.freedesktop.org
W: https://01.org/linuxgraphics/
+B: https://01.org/linuxgraphics/documentation/how-report-bugs
+C: irc://chat.freenode.net/intel-gfx
Q: http://patchwork.freedesktop.org/project/intel-gfx/
T: git git://anongit.freedesktop.org/drm-intel
S: Supported
#include "i915_drv.h"
#include "i915_trace.h"
-static bool mutex_is_locked_by(struct mutex *mutex, struct task_struct *task)
++static bool i915_gem_shrinker_lock(struct drm_device *dev, bool *unlock)
+ {
- if (!mutex_is_locked(mutex))
++ switch (mutex_trylock_recursive(&dev->struct_mutex)) {
++ case MUTEX_TRYLOCK_FAILED:
+ 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 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;
++ case MUTEX_TRYLOCK_SUCCESS:
++ *unlock = true;
++ return true;
+
++ case MUTEX_TRYLOCK_RECURSIVE:
+ *unlock = false;
- } else {
- *unlock = true;
++ return true;
+ }
+
- return true;
++ BUG();
+ }
+
static bool any_vma_pinned(struct drm_i915_gem_object *obj)
{
struct i915_vma *vma;