Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: Shrink objects prior to hibernation

In an attempt to keep the hibernation image as same as possible, let's
try and discard any unwanted pages and our own page arrays.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160909190218.16831-1-chris@chris-wilson.co.uk

+14 -7
+14 -7
drivers/gpu/drm/i915/i915_gem.c
··· 4589 4589 int i915_gem_freeze_late(struct drm_i915_private *dev_priv) 4590 4590 { 4591 4591 struct drm_i915_gem_object *obj; 4592 + struct list_head *phases[] = { 4593 + &dev_priv->mm.unbound_list, 4594 + &dev_priv->mm.bound_list, 4595 + NULL 4596 + }, **p; 4592 4597 4593 4598 /* Called just before we write the hibernation image. 4594 4599 * ··· 4604 4599 * 4605 4600 * To make sure the hibernation image contains the latest state, 4606 4601 * we update that state just before writing out the image. 4602 + * 4603 + * To try and reduce the hibernation image, we manually shrink 4604 + * the objects as well. 4607 4605 */ 4608 4606 4609 - list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) { 4610 - obj->base.read_domains = I915_GEM_DOMAIN_CPU; 4611 - obj->base.write_domain = I915_GEM_DOMAIN_CPU; 4612 - } 4607 + i915_gem_shrink_all(dev_priv); 4613 4608 4614 - list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) { 4615 - obj->base.read_domains = I915_GEM_DOMAIN_CPU; 4616 - obj->base.write_domain = I915_GEM_DOMAIN_CPU; 4609 + for (p = phases; *p; p++) { 4610 + list_for_each_entry(obj, *p, global_list) { 4611 + obj->base.read_domains = I915_GEM_DOMAIN_CPU; 4612 + obj->base.write_domain = I915_GEM_DOMAIN_CPU; 4613 + } 4617 4614 } 4618 4615 4619 4616 return 0;