[Intel-gfx] [PATCH v2 5/5] drm/i915: Revoke any shmemfs mappings on shrinking

Chris Wilson chris at chris-wilson.co.uk
Wed May 24 14:39:41 UTC 2017


When trying to shrink our buffers, also revoke any existing mappings
(forcing them to be faulted again on reuse) to improve the likelihood of
us being able to pageout the buffer.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
---
 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 7d400d882283..a9388a5eef31 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2212,8 +2212,9 @@ void __i915_gem_object_invalidate(struct drm_i915_gem_object *obj)
 	if (obj->base.filp == NULL)
 		return;
 
-	mapping = obj->base.filp->f_mapping,
+	mapping = obj->base.filp->f_mapping;
 	invalidate_mapping_pages(mapping, 0, (loff_t)-1);
+	unmap_mapping_range(mapping, 0, (loff_t)-1, 0);
 }
 
 static void
-- 
2.11.0



More information about the Intel-gfx mailing list