]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/amdgpu: skip clearing empty freed VM list on GEM close
authorBob Zhou <bobzhou2@amd.com>
Thu, 16 Jul 2026 02:44:36 +0000 (10:44 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 28 Jul 2026 23:59:08 +0000 (19:59 -0400)
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).

Signed-off-by: Bob Zhou <bobzhou2@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 8ba869e852d4f1b1c0e5ae9225c77f7ceccbe056)

drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c

index f224d33c4bc4981bcc396733d951822b9cbaa6b7..dc6a9d7dd0b28e191df8714dd24066d38e99a009 100644 (file)
@@ -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