wsl/hsakmt: Introduce WSL_CHECK_AVAIL_SYSRAM environment variable

By default, this variable is 0. Set it to 1 to compare available
system memory with the requested amount before allocation. It helps
identify system hangs caused by excessive memory allocation.

Signed-off-by: lyndonli <Lyndon.Li@amd.com>
Reviewed-by: Flora Cui <flora.cui@amd.com>
Part-of: <http://10.67.69.192/wsl/libhsakmt/-/merge_requests/32>
This commit is contained in:
lyndonli
2024-09-27 10:47:23 +08:00
committed by Frank Min
parent 7a67eb90e2
commit c898104228
4 changed files with 18 additions and 0 deletions
+5
View File
@@ -129,6 +129,11 @@ static HSAKMT_STATUS init_vars_from_env(void) {
if (envvar)
enable_vendor_packet = atoi(envvar);
/* Decide whether to check available system memory before allocation */
envvar = getenv("WSL_CHECK_AVAIL_SYSRAM");
if (envvar)
check_avail_sysram = !strcmp(envvar, "1");
return HSAKMT_STATUS_SUCCESS;
}