From 5858aa17a9ab7e4ca8e577d2dc7f861caba632bc Mon Sep 17 00:00:00 2001 From: Philip Yang Date: Thu, 23 Jan 2020 15:50:10 -0500 Subject: [PATCH] libhsakmt: Ignore mbind failure if flag NoSubstitute = 0 From Thunk spec, flag NoSubstitute = 0, if specific memory type is not available on node, allocation may fall back to other memory that can replace it on that node. mbind return failure if no memory available on the specific node, we should ignore the mbind failure for this case. Change-Id: I651a1bedf1852330604e56965cc17862403ebf87 Signed-off-by: Philip Yang --- src/fmm.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fmm.c b/src/fmm.c index b48fdc8f61..e2c45b5324 100644 --- a/src/fmm.c +++ b/src/fmm.c @@ -1492,9 +1492,6 @@ static int bind_mem_to_numa(uint32_t node_id, void *mem, numa_bitmask_free(node_mask); if (r) { - pr_warn_once("Failed to set NUMA policy for %p: %s\n", mem, - strerror(errno)); - /* If applcation is running inside docker, still return * ok because docker seccomp blocks mbind by default, * otherwise application cannot allocate system memory. @@ -1505,6 +1502,13 @@ static int bind_mem_to_numa(uint32_t node_id, void *mem, return 0; } + /* Ignore mbind failure if no memory available on node */ + if (!flags.ui32.NoSubstitute) + return 0; + + pr_warn_once("Failed to set NUMA policy for %p: %s\n", mem, + strerror(errno)); + return -EFAULT; }