[PATCH libdrm 1/2] libdrm: fix inefficient vamgr algorithm

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



issue: UMD allocates top 4GB, but don't do anything, just reserve top 4GB space,
but the performance of VP13 drops from 162fps to 99fps.

root cause:
our va hole list of vamgr is too long by time going.

fix:
reusing old hole as much as possible can make the list shortest.

result:
performance recovers as non-list path, next patch will remove non-list code path.

Change-Id: I3f00ef193815d31a78d416b53c1511098b88da8f
Signed-off-by: Chunming Zhou <david1.zhou at amd.com>
---
 amdgpu/amdgpu_vamgr.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/amdgpu/amdgpu_vamgr.c b/amdgpu/amdgpu_vamgr.c
index 6e0d7e37..66bb8ecd 100644
--- a/amdgpu/amdgpu_vamgr.c
+++ b/amdgpu/amdgpu_vamgr.c
@@ -94,9 +94,7 @@ amdgpu_vamgr_find_va(struct amdgpu_bo_va_mgr *mgr, uint64_t size,
 		return AMDGPU_INVALID_VA_ADDRESS;
 
 	pthread_mutex_lock(&mgr->bo_va_mutex);
-	/* TODO: using more appropriate way to track the holes */
-	/* first look for a hole */
-	LIST_FOR_EACH_ENTRY_SAFE(hole, n, &mgr->va_holes, list) {
+	LIST_FOR_EACH_ENTRY_SAFE_REV(hole, n, &mgr->va_holes, list) {
 		if (base_required) {
 			if(hole->offset > base_required ||
 				(hole->offset + hole->size) < (base_required + size))
@@ -183,9 +181,7 @@ static uint64_t amdgpu_vamgr_find_va_in_range(struct amdgpu_bo_va_mgr *mgr, uint
 	size = ALIGN(size, mgr->va_alignment);
 
 	pthread_mutex_lock(&mgr->bo_va_mutex);
-	/* TODO: using more appropriate way to track the holes */
-	/* first look for a hole */
-	LIST_FOR_EACH_ENTRY_SAFE(hole, n, &mgr->va_holes, list) {
+	LIST_FOR_EACH_ENTRY_SAFE_REV(hole, n, &mgr->va_holes, list) {
 		if (hole->offset > range_max ||
 			hole->offset + hole->size < range_min ||
 			(hole->offset > range_min && hole->offset + size > range_max) ||
-- 
2.14.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux