Skip to content

Commit 78b367e

Browse files
committed
memory patcher: add some clarifying comments
This is complicated stuff: add some comments so that future maintainers have some rationale to understand the way things have been done. Signed-off-by: Jeff Squyres <[email protected]>
1 parent 55a15fb commit 78b367e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

opal/mca/memory/patcher/memory_patcher_component.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
13+
* Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
1414
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
1515
* reserved.
1616
* Copyright (c) 2016 Research Organization for Information Science
@@ -92,6 +92,14 @@ opal_memory_patcher_component_t mca_memory_patcher_component = {
9292
#define memory_patcher_syscall syscall
9393
#endif
9494

95+
/*
96+
* The following block of code is #if 0'ed out because we do not need
97+
* to intercept mmap() any more (mmap() only deals with memory
98+
* protection; it does not invalidate any rcache entries for a given
99+
* region). But if we do someday, this is the code that we'll need.
100+
* It's a little non-trivial, so we might as well keep it (and #if 0
101+
* it out).
102+
*/
95103
#if 0
96104

97105
#if OPAL_MEMORY_PATCHER_HAVE___MMAP && !OPAL_MEMORY_PATCHER_HAVE___MMAP_PROTO
@@ -385,8 +393,8 @@ static int patcher_open (void)
385393
opal_mem_hooks_set_support (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT);
386394

387395
#if 0
388-
/* NTH: the only reason to hook mmap would be to detect memory protection. this does not invalidate
389-
* any cache entries in the region. */
396+
/* See above block to see why mmap() functionality is #if 0'ed
397+
out */
390398
rc = opal_patcher->patch_symbol ("mmap", (uintptr_t) intercept_mmap, (uintptr_t *) &original_mmap);
391399
if (OPAL_SUCCESS != rc) {
392400
return rc;
@@ -428,6 +436,7 @@ static int patcher_open (void)
428436

429437
static int patcher_close(void)
430438
{
431-
/* NTH: is it possible to unpatch the symbols? */
439+
/* Note that we don't need to unpatch any symbols here; the
440+
patcher framework will take care of all of that for us. */
432441
return OPAL_SUCCESS;
433442
}

0 commit comments

Comments
 (0)