diff src/share/vm/runtime/virtualspace.cpp @ 22977:33e421924c67

8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29 Summary: Allow use of large pages for auxiliary data structures in G1. Clean up existing interfaces. Reviewed-by: jmasa, pliden, stefank
author tschatzl
date Tue, 07 Apr 2015 10:53:51 +0200
parents 5788dbd1f2d6
children 30e04eba9e29
line wrap: on
line diff
--- a/src/share/vm/runtime/virtualspace.cpp	Fri Jan 16 10:29:12 2015 +0100
+++ b/src/share/vm/runtime/virtualspace.cpp	Tue Apr 07 10:53:51 2015 +0200
@@ -52,13 +52,21 @@
     _alignment(0), _special(false), _executable(false) {
 }
 
-ReservedSpace::ReservedSpace(size_t size) {
+ReservedSpace::ReservedSpace(size_t size, bool prefer_large_pages) {
   // Want to use large pages where possible and pad with small pages.
   size_t page_size = os::page_size_for_region_unaligned(size, 1);
   bool large_pages = page_size != (size_t)os::vm_page_size();
-  // Don't force the alignment to be large page aligned,
-  // since that will waste memory.
-  size_t alignment = os::vm_allocation_granularity();
+  size_t alignment;
+  if (large_pages && prefer_large_pages) {
+    alignment = MAX2(page_size, (size_t)os::vm_allocation_granularity());
+    // ReservedSpace initialization requires size to be aligned to the given
+    // alignment. Align the size up.
+    size = align_size_up(size, alignment);
+  } else {
+    // Don't force the alignment to be large page aligned,
+    // since that will waste memory.
+    alignment = os::vm_allocation_granularity();
+  }
   initialize(size, alignment, large_pages, NULL, 0, false);
 }