Wed, 17 Aug 2011 10:32:53 -0700
6791672: enable 1G and larger pages on solaris
Reviewed-by: ysr, iveresov, johnc
1.1 --- a/src/os/solaris/vm/os_solaris.cpp Tue Aug 16 08:02:29 2011 -0700 1.2 +++ b/src/os/solaris/vm/os_solaris.cpp Wed Aug 17 10:32:53 2011 -0700 1.3 @@ -3252,7 +3252,6 @@ 1.4 // supported Solaris versions, this combination 1.5 // is equivalent to +UseISM -UseMPSS. 1.6 1.7 -typedef int (*getpagesizes_func_type) (size_t[], int); 1.8 static size_t _large_page_size = 0; 1.9 1.10 bool os::Solaris::ism_sanity_check(bool warn, size_t * page_size) { 1.11 @@ -3284,23 +3283,29 @@ 1.12 } 1.13 1.14 bool os::Solaris::mpss_sanity_check(bool warn, size_t * page_size) { 1.15 - getpagesizes_func_type getpagesizes_func = 1.16 - CAST_TO_FN_PTR(getpagesizes_func_type, dlsym(RTLD_DEFAULT, "getpagesizes")); 1.17 - if (getpagesizes_func == NULL) { 1.18 - if (warn) { 1.19 - warning("MPSS is not supported by the operating system."); 1.20 - } 1.21 - return false; 1.22 - } 1.23 - 1.24 const unsigned int usable_count = VM_Version::page_size_count(); 1.25 if (usable_count == 1) { 1.26 return false; 1.27 } 1.28 1.29 + // Find the right getpagesizes interface. When solaris 11 is the minimum 1.30 + // build platform, getpagesizes() (without the '2') can be called directly. 1.31 + typedef int (*gps_t)(size_t[], int); 1.32 + gps_t gps_func = CAST_TO_FN_PTR(gps_t, dlsym(RTLD_DEFAULT, "getpagesizes2")); 1.33 + if (gps_func == NULL) { 1.34 + gps_func = CAST_TO_FN_PTR(gps_t, dlsym(RTLD_DEFAULT, "getpagesizes")); 1.35 + if (gps_func == NULL) { 1.36 + if (warn) { 1.37 + warning("MPSS is not supported by the operating system."); 1.38 + } 1.39 + return false; 1.40 + } 1.41 + } 1.42 + 1.43 // Fill the array of page sizes. 1.44 - int n = getpagesizes_func(_page_sizes, page_sizes_max); 1.45 + int n = (*gps_func)(_page_sizes, page_sizes_max); 1.46 assert(n > 0, "Solaris bug?"); 1.47 + 1.48 if (n == page_sizes_max) { 1.49 // Add a sentinel value (necessary only if the array was completely filled 1.50 // since it is static (zeroed at initialization)). 1.51 @@ -3308,6 +3313,7 @@ 1.52 DEBUG_ONLY(warning("increase the size of the os::_page_sizes array.");) 1.53 } 1.54 assert(_page_sizes[n] == 0, "missing sentinel"); 1.55 + trace_page_sizes("available page sizes", _page_sizes, n); 1.56 1.57 if (n == 1) return false; // Only one page size available. 1.58 1.59 @@ -3337,6 +3343,7 @@ 1.60 } 1.61 *page_size = _page_sizes[0]; 1.62 1.63 + trace_page_sizes("usable page sizes", _page_sizes, end + 1); 1.64 return true; 1.65 } 1.66
2.1 --- a/src/share/vm/runtime/os.cpp Tue Aug 16 08:02:29 2011 -0700 2.2 +++ b/src/share/vm/runtime/os.cpp Wed Aug 17 10:32:53 2011 -0700 2.3 @@ -1232,6 +1232,17 @@ 2.4 } 2.5 2.6 #ifndef PRODUCT 2.7 +void os::trace_page_sizes(const char* str, const size_t* page_sizes, int count) 2.8 +{ 2.9 + if (TracePageSizes) { 2.10 + tty->print("%s: ", str); 2.11 + for (int i = 0; i < count; ++i) { 2.12 + tty->print(" " SIZE_FORMAT, page_sizes[i]); 2.13 + } 2.14 + tty->cr(); 2.15 + } 2.16 +} 2.17 + 2.18 void os::trace_page_sizes(const char* str, const size_t region_min_size, 2.19 const size_t region_max_size, const size_t page_size, 2.20 const char* base, const size_t size)
3.1 --- a/src/share/vm/runtime/os.hpp Tue Aug 16 08:02:29 2011 -0700 3.2 +++ b/src/share/vm/runtime/os.hpp Wed Aug 17 10:32:53 2011 -0700 3.3 @@ -208,11 +208,13 @@ 3.4 size_t region_max_size, 3.5 uint min_pages); 3.6 3.7 - // Method for tracing page sizes returned by the above method; enabled by 3.8 + // Methods for tracing page sizes returned by the above method; enabled by 3.9 // TracePageSizes. The region_{min,max}_size parameters should be the values 3.10 // passed to page_size_for_region() and page_size should be the result of that 3.11 // call. The (optional) base and size parameters should come from the 3.12 // ReservedSpace base() and size() methods. 3.13 + static void trace_page_sizes(const char* str, const size_t* page_sizes, 3.14 + int count) PRODUCT_RETURN; 3.15 static void trace_page_sizes(const char* str, const size_t region_min_size, 3.16 const size_t region_max_size, 3.17 const size_t page_size,