drm/amdkfd: don't gate userptr cleanup on the owning mm
Subsystems (3)
PATCH 1/1 drm/amdkfd: don't gate userptr cleanup on the owning mm
amdgpu_ttm_tt_get_usermm() returns gtt->usertask->mm. By the time KFD frees its BOs from kfd_process_wq_release(), the process has long since run exit_mm() and that pointer is NULL, so the cleanup below is simply skipped on process teardown. mem->user_pages then leaks along with the page references it still holds, or mem->range on HMM builds.
Check the USERPTR alloc flag instead. It is set when the BO is created and stays valid no matter what the process does.
Signed-off-by Perry Yuan <[email protected]>
Reviewed-by Philip Yang <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1 -1
@@ -1954,7 +1954,7 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(return ret;/* Cleanup user pages and MMU notifiers */ -if (amdgpu_ttm_tt_get_usermm (mem->bo->tbo.ttm)) { +if (mem->alloc_flags &KFD_IOC_ALLOC_MEM_FLAGS_USERPTR ) {amdgpu_hmm_unregister (mem->bo);amdgpu_hmm_range_free (mem->range); mem->range =NULL ;
Signature · 1 line
2.34.1