diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-23 21:15:10 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-01-24 01:29:31 +0000 |
commit | 566cbf1ef53b1f970289fcd5b3b389a74beb7e78 (patch) | |
tree | f27b47aa3e6aba6d85cb3d6be80d242a93ec3637 | |
parent | b8d3353624be51f2b618467c899a9ce3cbf3cbfe (diff) |
sna: Abort search for a linear bo if we encounter a purged buffer
Given the rarity of encountering a purged buffer versus the frequency of
scanning the list and the then likely result of allocation a new buffer,
simply abort the search on the first purged bo.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 1e083ea1..3bcd5cc1 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -1802,7 +1802,7 @@ void kgem_cleanup_cache(struct kgem *kgem) static struct kgem_bo * search_linear_cache(struct kgem *kgem, unsigned int size, unsigned flags) { - struct kgem_bo *bo, *next, *first = NULL; + struct kgem_bo *bo, *first = NULL; bool use_active = (flags & CREATE_INACTIVE) == 0; struct list *cache; @@ -1850,7 +1850,7 @@ search_linear_cache(struct kgem *kgem, unsigned int size, unsigned flags) } cache = use_active ? active(kgem, size) : inactive(kgem, size); - list_for_each_entry_safe(bo, next, cache, list) { + list_for_each_entry(bo, cache, list) { assert(bo->refcnt == 0); assert(bo->reusable); assert(!!bo->rq == !!use_active); @@ -1863,7 +1863,7 @@ search_linear_cache(struct kgem *kgem, unsigned int size, unsigned flags) if (bo->purged && !kgem_bo_clear_purgeable(kgem, bo)) { kgem_bo_free(kgem, bo); - continue; + break; } if (I915_TILING_NONE != bo->tiling) { |