Skip to content

Commit

Permalink
memory/patcher: hook madvise
Browse files Browse the repository at this point in the history
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 <hjelmn@lanl.gov>
  • Loading branch information
hjelmn committed Aug 7, 2017
1 parent b6bf3f4 commit 8137623
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions opal/mca/memory/patcher/memory_patcher_component.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ static int patcher_query (int *);

static int mca_memory_patcher_priority;

/* NTH: we can't currently allow madvise to be intercepted due to a
* deadlock when running with glibc. In the future, we may re-enable
* this hook if the deadlock can be resolved. */
#define WANT_INTERCEPT_MADVISE 0

opal_memory_patcher_component_t mca_memory_patcher_component = {
.super = {
.memoryc_version = {
Expand Down Expand Up @@ -249,7 +244,6 @@ static void *intercept_mremap (void *start, size_t oldlen, void *new_address, si

#endif

#if WANT_INTERCEPT_MADVISE
#if defined (SYS_madvise)

static int (*original_madvise) (void *, size_t, int);
Expand Down Expand Up @@ -284,7 +278,6 @@ static int intercept_madvise (void *start, size_t length, int advice)
}

#endif
#endif // WANT_INTERCEPT_MADVISE

#if defined SYS_brk

Expand Down Expand Up @@ -503,14 +496,12 @@ static int patcher_open (void)
}
#endif

#if WANT_INTERCEPT_MADVISE
#if defined (SYS_madvise)
rc = opal_patcher->patch_symbol ("madvise", (uintptr_t)intercept_madvise, (uintptr_t *) &original_madvise);
if (OPAL_SUCCESS != rc) {
return rc;
}
#endif
#endif // WANT_INTERCEPT_MADVISE

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

0 comments on commit 8137623

Please sign in to comment.