From: John Harrison Subject: Re: [PATCH 24/42] drm/i915: Treat a framebuffer reference as an active reference whilst shrinking Date: Tue, 11 Oct 2016 10:54:00 +0100 Message-ID: <5c9e2cc4-540b-02b6-626e-93695ea87b75@Intel.com> References: <20161007094635.28319-1-chris@chris-wilson.co.uk> <20161007094635.28319-25-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1513076008==" Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id BFDE96E511 for ; Tue, 11 Oct 2016 09:54:02 +0000 (UTC) In-Reply-To: <20161007094635.28319-25-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org This is a multi-part message in MIME format. --===============1513076008== Content-Type: multipart/alternative; boundary="------------777D9B62D41AE4485503700F" This is a multi-part message in MIME format. --------------777D9B62D41AE4485503700F Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 07/10/2016 10:46, Chris Wilson wrote: > Treat a framebuffer reference with the same priority as an active > reference whilst shrinking. Framebuffers are likely to be reused and > typically cost more to migrate to and from GPU memory (on LLC > architectures we need to clflush), so defer the temptation to purge them > during a kswapd run until we have run out of cheap buffers. > > Signed-off-by: Chris Wilson > --- > drivers/gpu/drm/i915/i915_gem_shrinker.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c > index fa72473dc7f5..0241658af16b 100644 > --- a/drivers/gpu/drm/i915/i915_gem_shrinker.c > +++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c > @@ -214,8 +214,9 @@ i915_gem_shrink(struct drm_i915_private *dev_priv, > !is_vmalloc_addr(obj->mm.mapping)) > continue; > > - if ((flags & I915_SHRINK_ACTIVE) == 0 && > - i915_gem_object_is_active(obj)) > + if (!(flags & I915_SHRINK_ACTIVE) && > + (i915_gem_object_is_active(obj) || > + obj->framebuffer_references)) > continue; > > if (!can_release_pages(obj)) Reviewed-by: John Harrison --------------777D9B62D41AE4485503700F Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit On 07/10/2016 10:46, Chris Wilson wrote:
Treat a framebuffer reference with the same priority as an active
reference whilst shrinking. Framebuffers are likely to be reused and
typically cost more to migrate to and from GPU memory (on LLC
architectures we need to clflush), so defer the temptation to purge them
during a kswapd run until we have run out of cheap buffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_shrinker.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_shrinker.c b/drivers/gpu/drm/i915/i915_gem_shrinker.c
index fa72473dc7f5..0241658af16b 100644
--- a/drivers/gpu/drm/i915/i915_gem_shrinker.c
+++ b/drivers/gpu/drm/i915/i915_gem_shrinker.c
@@ -214,8 +214,9 @@ i915_gem_shrink(struct drm_i915_private *dev_priv,
 			    !is_vmalloc_addr(obj->mm.mapping))
 				continue;
 
-			if ((flags & I915_SHRINK_ACTIVE) == 0 &&
-			    i915_gem_object_is_active(obj))
+			if (!(flags & I915_SHRINK_ACTIVE) &&
+			    (i915_gem_object_is_active(obj) ||
+			     obj->framebuffer_references))
 				continue;
 
 			if (!can_release_pages(obj))

Reviewed-by: John Harrison <john.c.harrison@intel.com>

--------------777D9B62D41AE4485503700F-- --===============1513076008== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1513076008==--