diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-12-09 18:05:55 +0300 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2016-12-12 15:25:32 +0300 |
commit | 7155b057c61e55eed27bf478ac9b8034c4c97582 (patch) | |
tree | 26f3ffc904bd4154ee600f9bd9ee89de1f85c5d9 /drivers/gpu/drm/i915/i915_gem_evict.c | |
parent | dbb4351bab0a8440f6b02895c142bce6c30b7097 (diff) | |
download | linux-7155b057c61e55eed27bf478ac9b8034c4c97582.tar.xz |
drm/i915: Retire before attempting to evict from the active lists
Some object retain an extra pin whilst they are active (e.g. contexts).
This excludes them from being considered for eviction unless we idle the
GPU. If before we look at the active list, we retire beforehand we can
hopefully remove a few excess pins and reduce the amount of searching
required.
v2: Similar principle applies to evict_for_vma
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/20161209150555.602-1-chris@chris-wilson.co.uk
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'drivers/gpu/drm/i915/i915_gem_evict.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_evict.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index fa40100146ea..6457fd0c33a8 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c @@ -129,7 +129,14 @@ i915_gem_evict_something(struct i915_address_space *vm, } else drm_mm_init_scan(&vm->mm, min_size, alignment, cache_level); - if (flags & PIN_NONBLOCK) + /* Retire before we search the active list. Although we have + * reasonable accuracy in our retirement lists, we may have + * a stray pin (preventing eviction) that can only be resolved by + * retiring. + */ + if (!(flags & PIN_NONBLOCK)) + i915_gem_retire_requests(dev_priv); + else phases[1] = NULL; search_again: @@ -235,6 +242,14 @@ int i915_gem_evict_for_vma(struct i915_vma *target, unsigned int flags) lockdep_assert_held(&target->vm->i915->drm.struct_mutex); trace_i915_gem_evict_vma(target, flags); + /* Retire before we search the active list. Although we have + * reasonable accuracy in our retirement lists, we may have + * a stray pin (preventing eviction) that can only be resolved by + * retiring. + */ + if (!(flags & PIN_NONBLOCK)) + i915_gem_retire_requests(target->vm->i915); + check_color = target->vm->mm.color_adjust; if (check_color) { /* Expand search to cover neighbouring guard pages (or lack!) */ |