@@ -4748,6 +4748,7 @@ int i915_gem_freeze(struct drm_i915_private *dev_priv)
* running workqueue may wait on the struct_mutex.
*/
synchronize_rcu(); /* wait for our earlier RCU delayed slab frees */
+ flush_work(&dev_priv->mm.free_work);
intel_runtime_pm_put(dev_priv);
@@ -4789,6 +4790,7 @@ int i915_gem_freeze_late(struct drm_i915_private *dev_priv)
mutex_unlock(&dev_priv->drm.struct_mutex);
synchronize_rcu_expedited();
+ flush_work(&dev_priv->mm.free_work);
return 0;
}
@@ -329,6 +329,7 @@ i915_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
* blocked waiting on us to release struct_mutex.
*/
synchronize_rcu_expedited();
+ flush_work(&dev_priv->mm.free_work);
return freed;
}
Waiting a RCU grace period only guarantees the work gets queued, but until after the queued workqueue returns, there's no guarantee the memory was actually freed. So flush the work to provide better guarantees to the reclaim code in addition of waiting a RCU grace period to pass. Signed-off-by: Andrea Arcangeli <aarcange@redhat.com> --- drivers/gpu/drm/i915/i915_gem.c | 2 ++ drivers/gpu/drm/i915/i915_gem_shrinker.c | 1 + 2 files changed, 3 insertions(+)