drm/amdkfd: set memory limit to avoid OOM with HMM enabled
authorPhilip Yang <Philip.Yang@amd.com>
Thu, 15 Apr 2021 21:43:32 +0000 (17:43 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 21 Apr 2021 01:48:00 +0000 (21:48 -0400)
commitc46ebb6a6d9d28fce66595b56db070b0cc4fab71
tree1f4261847073083b15dd04869e2e989aeb43c182
parent814ab9930cfd709768439799eae3c7ef0a658b54
drm/amdkfd: set memory limit to avoid OOM with HMM enabled

HMM migration alloc sizeof(struct page) on system memory for each VRAM
page, it is 1GB system memory reserved for 64GB VRAM. To avoid
application OOM, increase system memory used size based on VRAM size of
all GPUs, then application alloc memory will fail if system memory usage
reach the limit.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Oak Zeng <Oak.Zeng@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
drivers/gpu/drm/amd/amdkfd/kfd_migrate.c