summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-12-18 19:51:17 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-12-18 19:51:17 +0000
commitb51e3de66292e4b29483324e1dbfeb2495817351 (patch)
treee3163ccbf2fd790427a1fccacc74e30d2b98dc6f
parentfed8d145c148bfa8a8a29f4088902377f9a10440 (diff)
sna: When freeing vma, first see if the kernel evicted any
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/kgem.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index fba0693b..6d7eceb2 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -2089,6 +2089,9 @@ uint32_t kgem_add_reloc(struct kgem *kgem,
static void kgem_trim_vma_cache(struct kgem *kgem)
{
+ if (kgem->vma_count > MAX_VMA_CACHE && kgem->need_purge)
+ kgem_purge_cache(kgem);
+
/* vma are limited on a per-process basis to around 64k.
* This includes all malloc arenas as well as other file
* mappings. In order to be fair and not hog the cache,