mirror of
https://github.com/torvalds/linux.git
synced 2026-04-22 16:53:59 -04:00
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>
This commit is contained in:
committed by
Alex Deucher
parent
814ab9930c
commit
c46ebb6a6d
@@ -108,6 +108,11 @@ void amdgpu_amdkfd_gpuvm_init_mem_limits(void)
|
||||
(kfd_mem_limit.max_ttm_mem_limit >> 20));
|
||||
}
|
||||
|
||||
void amdgpu_amdkfd_reserve_system_mem(uint64_t size)
|
||||
{
|
||||
kfd_mem_limit.system_mem_used += size;
|
||||
}
|
||||
|
||||
/* Estimate page table size needed to represent a given memory size
|
||||
*
|
||||
* With 4KB pages, we need one 8 byte PTE for each 4KB of memory
|
||||
|
||||
Reference in New Issue
Block a user