All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/i915: The shrinker already acquires struct_mutex, so call it unlocked
@ 2017-04-07 10:25 Chris Wilson
  2017-04-07 10:25 ` [PATCH 2/4] drm/i915: Drain any freed objects prior to hibernation Chris Wilson
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Chris Wilson @ 2017-04-07 10:25 UTC (permalink / raw)
  To: intel-gfx

The shrinker is prepared to be called unlock (and with struct_mutex held
for DIRECT_RECLAIM) so we can skip acquiring the struct_mutex prior to
calling the shrinking during freeze. This improves our ability to shrink
as we can be more aggressive when we know the caller isn't holding
struct_mutex.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 52b403b4f8c2..13cad69df20e 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -4886,9 +4886,10 @@ void i915_gem_load_cleanup(struct drm_i915_private *dev_priv)
 
 int i915_gem_freeze(struct drm_i915_private *dev_priv)
 {
-	mutex_lock(&dev_priv->drm.struct_mutex);
+	/* Discard all purgeable objects, let userspace recover those as
+	 * required after resuming.
+	 */
 	i915_gem_shrink_all(dev_priv);
-	mutex_unlock(&dev_priv->drm.struct_mutex);
 
 	return 0;
 }
@@ -4913,12 +4914,12 @@ int i915_gem_freeze_late(struct drm_i915_private *dev_priv)
 	 * we update that state just before writing out the image.
 	 *
 	 * To try and reduce the hibernation image, we manually shrink
-	 * the objects as well.
+	 * the objects as well, see i915_gem_freeze()
 	 */
 
-	mutex_lock(&dev_priv->drm.struct_mutex);
 	i915_gem_shrink(dev_priv, -1UL, I915_SHRINK_UNBOUND);
 
+	mutex_lock(&dev_priv->drm.struct_mutex);
 	for (p = phases; *p; p++) {
 		list_for_each_entry(obj, *p, global_link) {
 			obj->base.read_domains = I915_GEM_DOMAIN_CPU;
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-04-07 12:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-07 10:25 [PATCH 1/4] drm/i915: The shrinker already acquires struct_mutex, so call it unlocked Chris Wilson
2017-04-07 10:25 ` [PATCH 2/4] drm/i915: Drain any freed objects prior to hibernation Chris Wilson
2017-04-07 11:22   ` Joonas Lahtinen
2017-04-07 11:28     ` Chris Wilson
2017-04-07 10:25 ` [PATCH 3/4] drm/i915: Break up long runs of freeing objects Chris Wilson
2017-04-07 11:22   ` Joonas Lahtinen
2017-04-07 10:25 ` [PATCH 4/4] drm/i915: Insert cond_resched() into i915_gem_free_objects Chris Wilson
2017-04-07 11:23   ` Joonas Lahtinen
2017-04-07 12:40     ` Chris Wilson
2017-04-07 10:44 ` ✓ Fi.CI.BAT: success for series starting with [1/4] drm/i915: The shrinker already acquires struct_mutex, so call it unlocked Patchwork
2017-04-07 11:21 ` [PATCH 1/4] " Joonas Lahtinen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.