Skip to contentSkip to conversation

drm/amdgpu: skip clearing empty freed VM list on GEM close

PATCH In review Bob Zhou 2 participants 2 messages Jul 16

Subsystems (2)
lore
Share & tools
lore

Bob Zhou

author
#0 lore raw

PATCH v2 1/1 drm/amdgpu: skip clearing empty freed VM list on GEM close

amdgpu_vm_clear_freed() allocates an amdgpu_sync object and walks the VM reservation fences via amdgpu_sync_resv() before checking whether vm->freed has anything to clear. Return early when the list is empty to skip this overhead on a hot path (every GEM close and command submission).

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
index 157d4168907ce..eb6a70fe79ceb 100644
@@ -1553,6 +1553,8 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
 	struct amdgpu_sync sync;
 	int r;
 
+	if (list_empty(&vm->freed))
+		return 0;
 
 	/*
 	 * Implicitly sync to command submissions in the same VM before
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Bob Zhou

amdgpu_vm_clear_freed() allocates an amdgpu_sync object and walks the VM reservation fences via amdgpu_sync_resv() before checking whether vm->freed has anything to clear. Return early when the list is empty to skip this overhead on a hot path (every GEM close and command submission).

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +2 -0
index 157d4168907ce..eb6a70fe79ceb 100644
@@ -1553,6 +1553,8 @@ int amdgpu_vm_clear_freed(struct amdgpu_device *adev,
  	struct amdgpu_sync sync;
  	int r;
 
+	if (list_empty(&vm->freed))
+		return 0;
 
  	/*
  	 * Implicitly sync to command submissions in the same VM before