[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170406232347.988-3-aarcange@redhat.com>
Date: Fri, 7 Apr 2017 01:23:44 +0200
From: Andrea Arcangeli <aarcange@...hat.com>
To: Martin Kepplinger <martink@...teo.de>,
Thorsten Leemhuis <regressions@...mhuis.info>,
daniel.vetter@...el.com, Dave Airlie <airlied@...il.com>,
Chris Wilson <chris@...is-wilson.co.uk>
Cc: intel-gfx@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: [PATCH 2/5] i915: flush gem obj freeing workqueues to add accuracy to the i915 shrinker
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@...hat.com>
---
drivers/gpu/drm/i915/i915_gem.c | 2 ++
drivers/gpu/drm/i915/i915_gem_shrinker.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 3982489..612fde3 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -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;
}
diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index fea1454..30f79af 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -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;
}
Powered by blists - more mailing lists