From d2e1b4058321541e908be4c19fd360e2632b3987 Mon Sep 17 00:00:00 2001 From: Mark Allen Date: Tue, 24 Jan 2017 15:03:40 -0500 Subject: [PATCH] fix a memory hook recursion hang Without this checkin, it's possible for a stack trace like the following to occur: free() madvise() intercept_madvise() opal_mem_hooks_release_hook(), loop of registered callbacks which includes ompi_mtl_mxm_mem_release_cb() mxm_mem_unmap(,,from_alloc=false) ... free() The problem is since we're already in glibc free() we need to call the release callback with from_alloc=true so it will take a more conservative path and only record the memory being released without making any malloc/free calls. Signed-off-by: Austen Lauria (cherry picked from commit d620ad10c18a2e7e11e44f154bb737cd17933940) --- opal/mca/memory/patcher/memory_patcher_component.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opal/mca/memory/patcher/memory_patcher_component.c b/opal/mca/memory/patcher/memory_patcher_component.c index f6405e9159c..e70cfb6455b 100644 --- a/opal/mca/memory/patcher/memory_patcher_component.c +++ b/opal/mca/memory/patcher/memory_patcher_component.c @@ -285,7 +285,7 @@ static int _intercept_madvise (void *start, size_t length, int advice) #endif advice == POSIX_MADV_DONTNEED) { - opal_mem_hooks_release_hook (start, length, false); + opal_mem_hooks_release_hook (start, length, true); } if (!original_madvise) {