libhsakmt: call madvise() from fmm_allocate_device

This is needed to avoid additional references to mapped BOs in child
processes that can prevent freeing memory in the parent process and lead
to out-of-memory conditions.

Change-Id: I25c90510a14dde515cc23ea5dc1f68e8d7e37a66
Signed-off-by: Philip Cox <Philip.Cox@amd.com>


[ROCm/ROCR-Runtime commit: f7a3427c99]
Este cometimento está contido em:
Philip Cox cometeu 2020-08-19 13:33:47 -04:00
1 ascendente 32cb33a6a6
cometimento 52a223ac90
1 ficheiro modificado
+7
+7
Ver ficheiro
@@ -1361,6 +1361,13 @@ void *fmm_allocate_device(uint32_t gpu_id, void *address, uint64_t MemorySizeInB
__fmm_release(vm_obj, aperture);
return NULL;
}
/*
* This madvise() call is needed to avoid additional references
* to mapped BOs in child processes that can prevent freeing
* memory in the parent process and lead to out-of-memory
* conditions.
*/
madvise(mem, MemorySizeInBytes, MADV_DONTFORK);
}
return mem;