Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1618404

[PATCH 2/5] i915: flush gem obj freeing workqueues to add accuracy to the i915 shrinker

From Andrea Arcangeli <aarcange@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 2/5] i915: flush gem obj freeing workqueues to add accuracy to the i915 shrinker
Date 2017-04-07 01:30 +0200
Message-ID <ttp0J-7ym-17@gated-at.bofh.it> (permalink)
References <tsbVU-7s-13@gated-at.bofh.it> <ttp0J-7ym-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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(+)

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;
 }

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [Intel-gfx] [BUG][REGRESSION] i915 gpu hangs under load Thorsten Leemhuis <regressions@leemhuis.info> - 2017-04-02 14:00 +0200
  Re: [Intel-gfx] [BUG][REGRESSION] i915 gpu hangs under load Martin Kepplinger <martink@posteo.de> - 2017-04-02 14:20 +0200
    Re: [Intel-gfx] [BUG][REGRESSION] i915 gpu hangs under load Jani Nikula <jani.nikula@linux.intel.com> - 2017-04-03 17:20 +0200
      [PATCH 1/5] i915: avoid kernel hang caused by synchronize rcu struct_mutex deadlock Andrea Arcangeli <aarcange@redhat.com> - 2017-04-07 01:30 +0200
        Re: [Intel-gfx] [PATCH 1/5] i915: avoid kernel hang caused by  synchronize rcu struct_mutex deadlock Joonas Lahtinen <joonas.lahtinen@linux.intel.com> - 2017-04-07 11:10 +0200
      [PATCH 3/5] i915: initialize the free_list of the fencing atomic_helper Andrea Arcangeli <aarcange@redhat.com> - 2017-04-07 01:30 +0200
        Re: [PATCH 3/5] i915: initialize the free_list of the fencing  atomic_helper Chris Wilson <chris@chris-wilson.co.uk> - 2017-04-07 12:40 +0200
      [PATCH 5/5] i915: fence workqueue optimization Andrea Arcangeli <aarcange@redhat.com> - 2017-04-07 01:30 +0200
        Re: [PATCH 5/5] i915: fence workqueue optimization Chris Wilson <chris@chris-wilson.co.uk> - 2017-04-07 12:00 +0200
          Re: [PATCH 5/5] i915: fence workqueue optimization Andrea Arcangeli <aarcange@redhat.com> - 2017-04-07 15:20 +0200
      [PATCH 4/5] i915: schedule while freeing the lists of gem objects Andrea Arcangeli <aarcange@redhat.com> - 2017-04-07 01:30 +0200
      [PATCH 0/5] Re: [Intel-gfx] [BUG][REGRESSION] i915 gpu hangs under load Andrea Arcangeli <aarcange@redhat.com> - 2017-04-07 01:30 +0200
        [PATCH 2/5] i915: flush gem obj freeing workqueues to add accuracy to the i915 shrinker Andrea Arcangeli <aarcange@redhat.com> - 2017-04-07 01:30 +0200
          Re: [PATCH 2/5] i915: flush gem obj freeing workqueues to add  accuracy to the i915 shrinker Chris Wilson <chris@chris-wilson.co.uk> - 2017-04-07 12:10 +0200
            Re: [PATCH 2/5] i915: flush gem obj freeing workqueues to add  accuracy to the i915 shrinker Andrea Arcangeli <aarcange@redhat.com> - 2017-04-07 15:10 +0200
              Re: [PATCH 2/5] i915: flush gem obj freeing workqueues to add  accuracy to the i915 shrinker Chris Wilson <chris@chris-wilson.co.uk> - 2017-04-07 17:40 +0200
                Re: [PATCH 2/5] i915: flush gem obj freeing workqueues to add  accuracy to the i915 shrinker Andrea Arcangeli <aarcange@redhat.com> - 2017-04-09 22:20 +0200
                Re: [PATCH 2/5] i915: flush gem obj freeing workqueues to add  accuracy to the i915 shrinker Chris Wilson <chris@chris-wilson.co.uk> - 2017-04-10 11:40 +0200
        Re: [PATCH 0/5] Re: [Intel-gfx] [BUG][REGRESSION] i915 gpu hangs  under load Martin Kepplinger <martink@posteo.de> - 2017-04-10 12:20 +0200

csiph-web