[PATCH 65/76] drm/i915: Drop the unbound page cache upon idling

Chris Wilson chris at chris-wilson.co.uk
Wed Jan 24 21:41:40 UTC 2018


When the GPU is idle, we can take a breather and release our hold on our
many caches. One such cache is that we keep objects pinned in memory
even when they are no longer accessible by the GPU, that cache is held
until the system comes under memory pressure. As we are idle, we can be
reasonably confident that the pages will not be used again in the near
future, so let the system know it can recover the memory for its own
purposes.

Suggested-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 6a8cec9494f9..786a9aae6bf7 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3481,6 +3481,8 @@ i915_gem_idle_work_handler(struct work_struct *work)
 	i915_gem_timelines_park(dev_priv);
 
 	i915_pmu_gt_parked(dev_priv);
+	/* Discard all currently unused caching of obj->mm.pages */
+	i915_gem_shrink(dev_priv, -1UL, NULL, I915_SHRINK_UNBOUND);
 
 	intel_rps_idle(dev_priv);
 
@@ -3491,7 +3493,6 @@ i915_gem_idle_work_handler(struct work_struct *work)
 	rearm_hangcheck = false;
 
 	intel_display_power_put(dev_priv, POWER_DOMAIN_GT_IRQ);
-
 	intel_runtime_pm_put(dev_priv);
 out_unlock:
 	mutex_unlock(&dev_priv->drm.struct_mutex);
-- 
2.15.1



More information about the Intel-gfx-trybot mailing list