[Intel-gfx] [PATCH 4/7] drm/i915: Check PIN_NONFAULT overlaps in evict_for_node

Chris Wilson chris at chris-wilson.co.uk
Mon Oct 9 13:39:20 UTC 2017


Quoting Joonas Lahtinen (2017-10-09 13:17:24)
> On Mon, 2017-10-09 at 09:43 +0100, Chris Wilson wrote:
> > If the caller says that he doesn't want to evict any other faulting
> > vma, honour that flag. The logic was used in evict_something, but not
> > the more specific evict_for_node, now being used as a preliminary probe
> > since commit 606fec956c0e ("drm/i915: Prefer random replacement before
> > eviction search").
> > 
> > Fixes: 606fec956c0e ("drm/i915: Prefer random replacement before eviction search")
> > Fixes: 821188778b9b ("drm/i915: Choose not to evict faultable objects from the GGTT")
> > References: https://patchwork.freedesktop.org/patch/174781/
> > Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> > Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
> 
> Could have merged with the previous test, too?

Yes, it could have been. I tend to favour verbosity in if(), the
compiler will merge identical jmps (or at least should), but a long
branching expression combining & and &&, or !, | or || I think is harder
to read than separate if()s. Then when inspired it becomes easler to
add comments before each branch. The counter argument would be is the
expressions were logically connected (when almost by definition they
need to be in the same logical expression :)
-Chris


More information about the Intel-gfx mailing list