|  | 
| 10 | 10 |  *                         University of Stuttgart.  All rights reserved. | 
| 11 | 11 |  * Copyright (c) 2004-2005 The Regents of the University of California. | 
| 12 | 12 |  *                         All rights reserved. | 
| 13 |  | - * Copyright (c) 2009-2016 Cisco Systems, Inc.  All rights reserved. | 
|  | 13 | + * Copyright (c) 2009-2017 Cisco Systems, Inc.  All rights reserved | 
| 14 | 14 |  * Copyright (c) 2013-2017 Los Alamos National Security, LLC. All rights | 
| 15 | 15 |  *                         reserved. | 
| 16 | 16 |  * Copyright (c) 2016      Research Organization for Information Science | 
| @@ -59,6 +59,11 @@ static int patcher_query (int *); | 
| 59 | 59 | 
 | 
| 60 | 60 | static int mca_memory_patcher_priority; | 
| 61 | 61 | 
 | 
|  | 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 | + | 
| 62 | 67 | opal_memory_patcher_component_t mca_memory_patcher_component = { | 
| 63 | 68 |     .super = { | 
| 64 | 69 |         .memoryc_version = { | 
| @@ -244,6 +249,7 @@ static void *intercept_mremap (void *start, size_t oldlen, void *new_address, si | 
| 244 | 249 | 
 | 
| 245 | 250 | #endif | 
| 246 | 251 | 
 | 
|  | 252 | +#if WANT_INTERCEPT_MADVISE | 
| 247 | 253 | #if defined (SYS_madvise) | 
| 248 | 254 | 
 | 
| 249 | 255 | static int (*original_madvise) (void *, size_t, int); | 
| @@ -278,6 +284,7 @@ static int intercept_madvise (void *start, size_t length, int advice) | 
| 278 | 284 | } | 
| 279 | 285 | 
 | 
| 280 | 286 | #endif | 
|  | 287 | +#endif // WANT_INTERCEPT_MADVISE | 
| 281 | 288 | 
 | 
| 282 | 289 | #if defined SYS_brk | 
| 283 | 290 | 
 | 
| @@ -496,16 +503,14 @@ static int patcher_open (void) | 
| 496 | 503 |     } | 
| 497 | 504 | #endif | 
| 498 | 505 | 
 | 
| 499 |  | -    /* NTH: we can't currently allow madvise to be intercepted due to a deadlock when running with glibc. in | 
| 500 |  | -     * the future we may re-enable this hook if the deadlock can be resolved. */ | 
| 501 |  | -#if 0 | 
|  | 506 | +#if WANT_INTERCEPT_MADVISE | 
| 502 | 507 | #if defined (SYS_madvise) | 
| 503 | 508 |     rc = opal_patcher->patch_symbol ("madvise", (uintptr_t)intercept_madvise, (uintptr_t *) &original_madvise); | 
| 504 | 509 |     if (OPAL_SUCCESS != rc) { | 
| 505 | 510 |         return rc; | 
| 506 | 511 |     } | 
| 507 | 512 | #endif | 
| 508 |  | -#endif | 
|  | 513 | +#endif // WANT_INTERCEPT_MADVISE | 
| 509 | 514 | 
 | 
| 510 | 515 | #if defined(SYS_shmdt) && defined(__linux__) | 
| 511 | 516 |     rc = opal_patcher->patch_symbol ("shmdt", (uintptr_t) intercept_shmdt, (uintptr_t *) &original_shmdt); | 
|  | 
0 commit comments