|
@@ -53,6 +53,17 @@ static bool i915_gem_shrinker_lock(struct drm_device *dev, bool *unlock)
|
|
|
BUG();
|
|
|
}
|
|
|
|
|
|
+static void i915_gem_shrinker_unlock(struct drm_device *dev, bool unlock)
|
|
|
+{
|
|
|
+ if (!unlock)
|
|
|
+ return;
|
|
|
+
|
|
|
+ mutex_unlock(&dev->struct_mutex);
|
|
|
+
|
|
|
+ /* expedite the RCU grace period to free some request slabs */
|
|
|
+ synchronize_rcu_expedited();
|
|
|
+}
|
|
|
+
|
|
|
static bool any_vma_pinned(struct drm_i915_gem_object *obj)
|
|
|
{
|
|
|
struct i915_vma *vma;
|
|
@@ -232,11 +243,8 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
|
|
|
intel_runtime_pm_put(dev_priv);
|
|
|
|
|
|
i915_gem_retire_requests(dev_priv);
|
|
|
- if (unlock)
|
|
|
- mutex_unlock(&dev_priv->drm.struct_mutex);
|
|
|
|
|
|
- /* expedite the RCU grace period to free some request slabs */
|
|
|
- synchronize_rcu_expedited();
|
|
|
+ i915_gem_shrinker_unlock(&dev_priv->drm, unlock);
|
|
|
|
|
|
return count;
|
|
|
}
|
|
@@ -293,8 +301,7 @@ i915_gem_shrinker_count(struct shrinker *shrinker, struct shrink_control *sc)
|
|
|
count += obj->base.size >> PAGE_SHIFT;
|
|
|
}
|
|
|
|
|
|
- if (unlock)
|
|
|
- mutex_unlock(&dev->struct_mutex);
|
|
|
+ i915_gem_shrinker_unlock(dev, unlock);
|
|
|
|
|
|
return count;
|
|
|
}
|
|
@@ -321,8 +328,8 @@ i915_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
|
|
|
sc->nr_to_scan - freed,
|
|
|
I915_SHRINK_BOUND |
|
|
|
I915_SHRINK_UNBOUND);
|
|
|
- if (unlock)
|
|
|
- mutex_unlock(&dev->struct_mutex);
|
|
|
+
|
|
|
+ i915_gem_shrinker_unlock(dev, unlock);
|
|
|
|
|
|
return freed;
|
|
|
}
|
|
@@ -364,8 +371,7 @@ i915_gem_shrinker_unlock_uninterruptible(struct drm_i915_private *dev_priv,
|
|
|
struct shrinker_lock_uninterruptible *slu)
|
|
|
{
|
|
|
dev_priv->mm.interruptible = slu->was_interruptible;
|
|
|
- if (slu->unlock)
|
|
|
- mutex_unlock(&dev_priv->drm.struct_mutex);
|
|
|
+ i915_gem_shrinker_unlock(&dev_priv->drm, slu->unlock);
|
|
|
}
|
|
|
|
|
|
static int
|