changeset 3845:3f0dff7a9cf5

7151089: PS NUMA: NUMA allocator should not attempt to free pages when using SHM large pages Summary: Don't attempt to uncommit SHM-based large pages Reviewed-by: kvn
author iveresov
date Mon, 12 Mar 2012 13:12:07 -0700
parents 3442eb7ef2d2
children cbdd11a54b82
files src/os/linux/vm/os_linux.cpp
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/linux/vm/os_linux.cpp	Tue Jan 14 20:24:44 2014 -0500
+++ b/src/os/linux/vm/os_linux.cpp	Mon Mar 12 13:12:07 2012 -0700
@@ -2568,7 +2568,14 @@
 }
 
 void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
-  commit_memory(addr, bytes, alignment_hint, false);
+  // This method works by doing an mmap over an existing mmaping and effectively discarding
+  // the existing pages. However it won't work for SHM-based large pages that cannot be
+  // uncommitted at all. We don't do anything in this case to avoid creating a segment with
+  // small pages on top of the SHM segment. This method always works for small pages, so we
+  // allow that in any case.
+  if (alignment_hint <= (size_t)os::vm_page_size() || !UseSHM) {
+    commit_memory(addr, bytes, alignment_hint, false);
+  }
 }
 
 void os::numa_make_global(char *addr, size_t bytes) {