[PATCH 2/2] drm/amdgpu: do not redundantly update page tables.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Fri Aug 14 11:08:41 PDT 2015


Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index e02e353..9a1da86 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -844,7 +844,7 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 			struct ttm_mem_reg *mem)
 {
 	struct amdgpu_vm *vm = bo_va->vm;
-	struct amdgpu_bo_va_mapping *mapping;
+	struct amdgpu_bo_va_mapping *mapping, *next;
 	uint32_t flags;
 	uint64_t addr;
 	int r;
@@ -864,11 +864,14 @@ int amdgpu_vm_bo_update(struct amdgpu_device *adev,
 		list_splice_init(&bo_va->valids, &bo_va->invalids);
 	spin_unlock(&vm->status_lock);
 
-	list_for_each_entry(mapping, &bo_va->invalids, list) {
+	list_for_each_entry_safe(mapping, next, &bo_va->invalids, list) {
 		r = amdgpu_vm_bo_update_mapping(adev, vm, mapping, addr,
 						flags, &bo_va->last_pt_update);
 		if (r)
 			return r;
+
+		list_del_init(&mapping->list);
+		list_add(&mapping->list, &bo_va->valids);
 	}
 
 	spin_lock(&vm->status_lock);
-- 
2.5.0



More information about the dri-devel mailing list