From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH 08/29] drm/i915: Rework __i915_gem_shrink Date: Mon, 5 Aug 2013 10:59:14 +0200 Message-ID: <20130805085914.GE22035@phenom.ffwll.local> References: <1375315222-4785-1-git-send-email-ben@bwidawsk.net> <1375315222-4785-9-git-send-email-ben@bwidawsk.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-we0-f174.google.com (mail-we0-f174.google.com [74.125.82.174]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A33DE5C70 for ; Mon, 5 Aug 2013 01:59:08 -0700 (PDT) Received: by mail-we0-f174.google.com with SMTP id q54so2184404wes.5 for ; Mon, 05 Aug 2013 01:59:07 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1375315222-4785-9-git-send-email-ben@bwidawsk.net> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Ben Widawsky Cc: Intel GFX List-Id: intel-gfx@lists.freedesktop.org On Wed, Jul 31, 2013 at 05:00:01PM -0700, Ben Widawsky wrote: > In order to do this for all VMs, it's convenient to rework the logic a > bit. This should have no functional impact. > > Signed-off-by: Ben Widawsky I didn't read ahead but I guess the actual shrink code here will move to the unbound list like the count code beforehand? Just for symmetry I think that'd be worth it. Patch applied since it looks neater ;-) -Daniel > --- > drivers/gpu/drm/i915/i915_gem.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c > index 3aaf875..3ce9d0d 100644 > --- a/drivers/gpu/drm/i915/i915_gem.c > +++ b/drivers/gpu/drm/i915/i915_gem.c > @@ -1693,9 +1693,14 @@ __i915_gem_shrink(struct drm_i915_private *dev_priv, long target, > } > > list_for_each_entry_safe(obj, next, &vm->inactive_list, mm_list) { > - if ((i915_gem_object_is_purgeable(obj) || !purgeable_only) && > - i915_gem_object_unbind(obj) == 0 && > - i915_gem_object_put_pages(obj) == 0) { > + > + if (!i915_gem_object_is_purgeable(obj) && purgeable_only) > + continue; > + > + if (i915_gem_object_unbind(obj)) > + continue; > + > + if (!i915_gem_object_put_pages(obj)) { > count += obj->base.size >> PAGE_SHIFT; > if (count >= target) > return count; > -- > 1.8.3.4 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch