Re: [PATCH v2] drm/amdgpu: skip clearing empty freed VM list on GEM close

"Kuehling, Felix" <[email protected]>
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <[email protected]>
On 2026-07-15 22:56, Bob Zhou wrote:
> 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 <[email protected]>

Reviewed-by: Felix Kuehling <[email protected]>


> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index 157d4168907ce..eb6a70fe79ceb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.