diff mbox

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

Message ID 1439575721-876-2-git-send-email-bas@basnieuwenhuizen.nl (mailing list archive)
State New, archived
Headers show

Commit Message

Bas Nieuwenhuizen Aug. 14, 2015, 6:08 p.m. UTC
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

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);