Skip to content

Commit c43563b

Browse files
committed
memory/patcher: hook madvise
It is not possible to use the patcher based memory hooks without hooking madvise (MADV_DONTNEED). This commit updates the patcher memory hooks to always hook madvise. This should be safe with recent rcache updates. References #3685. Close when merged into v2.0.x, v2.x, and v3.0.x. Signed-off-by: Nathan Hjelm <[email protected]> (cherry picked from commit 0176000) Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 49b9a55 commit c43563b

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

opal/mca/memory/patcher/memory_patcher_component.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ static int patcher_query (int *);
5959

6060
static int mca_memory_patcher_priority;
6161

62-
/* NTH: we can't currently allow madvise to be intercepted due to a
63-
* deadlock when running with glibc. In the future, we may re-enable
64-
* this hook if the deadlock can be resolved. */
65-
#define WANT_INTERCEPT_MADVISE 0
66-
6762
opal_memory_patcher_component_t mca_memory_patcher_component = {
6863
.super = {
6964
.memoryc_version = {
@@ -249,7 +244,6 @@ static void *intercept_mremap (void *start, size_t oldlen, void *new_address, si
249244

250245
#endif
251246

252-
#if WANT_INTERCEPT_MADVISE
253247
#if defined (SYS_madvise)
254248

255249
static int (*original_madvise) (void *, size_t, int);
@@ -284,7 +278,6 @@ static int intercept_madvise (void *start, size_t length, int advice)
284278
}
285279

286280
#endif
287-
#endif // WANT_INTERCEPT_MADVISE
288281

289282
#if defined SYS_brk
290283

@@ -503,14 +496,12 @@ static int patcher_open (void)
503496
}
504497
#endif
505498

506-
#if WANT_INTERCEPT_MADVISE
507499
#if defined (SYS_madvise)
508500
rc = opal_patcher->patch_symbol ("madvise", (uintptr_t)intercept_madvise, (uintptr_t *) &original_madvise);
509501
if (OPAL_SUCCESS != rc) {
510502
return rc;
511503
}
512504
#endif
513-
#endif // WANT_INTERCEPT_MADVISE
514505

515506
#if defined(SYS_shmdt) && defined(__linux__)
516507
rc = opal_patcher->patch_symbol ("shmdt", (uintptr_t) intercept_shmdt, (uintptr_t *) &original_shmdt);

0 commit comments

Comments
 (0)