drm/i915: Keep the mm.bound_list in rough LRU order
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 27 Jul 2015 09:26:26 +0000 (10:26 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 28 Jul 2015 14:05:41 +0000 (16:05 +0200)
commit6c24695988774d56ea8d6a47ffdaf0fd32072488
treea74aa6124c15ffc6113087446c0ee527aa3f02e9
parent3b9a02e844948fc14cb32a06bc00e0e61bde3577
drm/i915: Keep the mm.bound_list in rough LRU order

When we shrink our working sets, we want to avoid stealing pages from
objects that likely to be reused in the near future. We first look at
inactive objects before processing active objects - but what about a
recently active object that is about to be used again. That object's
position in the bound_list is ordered by the time of binding, not the
time of last use, so the most recently used inactive object could well
be at the head of the shrink list. To compensate, give the object a bump
to MRU when it becomes inactive (thus transitioning to the end of the
first pass in shrink lists). Conversely, bumping on inactive makes
bumping on active useless, since when we do have to reap from the active
working set, everything is going to become inactive very quickly and the
order pretty much random - just hope for the best at that point, as once
we start stalling on active objects, we can hope that the rebinding
neatly orders vital objects.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
[danvet: Resolve merge conflict.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem.c