From 24df8ab9742f771cfeb6d30bd8a61a17a9e22ca7 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 13 Jan 2012 16:15:21 +0000 Subject: [PATCH] sna: Reverse the chronological sort order of inactive vma entries The goal is to reuse the most recently bound GTT mapping in the hope that is still mappable at the time of reuse. Signed-off-by: Chris Wilson --- src/sna/kgem.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 30cdff6f..55034842 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -858,7 +858,7 @@ inline static void kgem_bo_move_to_inactive(struct kgem *kgem, bo->map = NULL; } if (bo->map) { - list_move_tail(&bo->vma, &kgem->vma[type].inactive[bo->bucket]); + list_move(&bo->vma, &kgem->vma[type].inactive[bo->bucket]); kgem->vma[type].count++; } } @@ -2552,9 +2552,7 @@ static void kgem_trim_vma_cache(struct kgem *kgem, int type, int bucket) j++) { struct list *head = &kgem->vma[type].inactive[i++%ARRAY_SIZE(kgem->vma[type].inactive)]; if (!list_is_empty(head)) - bo = list_first_entry(head, - struct kgem_bo, - vma); + bo = list_last_entry(head, struct kgem_bo, vma); } if (bo == NULL) break;