[Intel-gfx] [PATCH 5/5] drm/i915: Implement an oom-notifier for last resort shrinking
Chris Wilson
chris at chris-wilson.co.uk
Tue May 20 10:41:33 CEST 2014
On Tue, May 20, 2014 at 10:38:05AM +0200, Daniel Vetter wrote:
> On Tue, May 20, 2014 at 08:28:43AM +0100, Chris Wilson wrote:
> And one bikeshed below.
> > + unbound = bound = pinned = 0;
> > + list_for_each_entry(obj, &dev_priv->mm.unbound_list, global_list) {
> > + if (!obj->base.filp) /* not backed by a freeable object */
> > + continue;
> > +
> > + if (obj->pages_pin_count)
> > + pinned += obj->base.size;
> > + else
> > + unbound += obj->base.size;
> > + }
> > + list_for_each_entry(obj, &dev_priv->mm.bound_list, global_list) {
> > + if (!obj->base.filp)
> > + continue;
> > +
> > + if (obj->pages_pin_count)
> > + pinned += obj->base.size;
> > + else
> > + bound += obj->base.size;
> > + }
> > +
> > + if (unlock)
> > + mutex_unlock(&dev->struct_mutex);
> > +
> > + pr_info("Purging GPU memory, %lu bytes freed, %lu bytes still pinned.\n",
> > + freed, pinned);
> > + if (unbound | bound)
>
> I prefer a boolean || here since we compare against non-zero for each and
> not bitfields.
Heh, and I prefer a union since we only care if either is non-zero and
don't want the code enlargement of short-circuiting. ;-)
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the Intel-gfx
mailing list