8187230: [aix] Leave OS guard page size at default for non-java threads instead of explicitly setting it
authorstuefe
Thu, 07 Sep 2017 15:40:20 +0200
changeset 47645 3e7702cd3f19
parent 47644 236ae284a986
child 47646 c20cc2d3aa39
child 47654 dbd1f4f276ba
8187230: [aix] Leave OS guard page size at default for non-java threads instead of explicitly setting it Reviewed-by: goetz, dholmes
src/hotspot/os/aix/os_aix.cpp
src/hotspot/os/aix/os_aix.hpp
--- a/src/hotspot/os/aix/os_aix.cpp	Tue Oct 17 20:21:50 2017 -0400
+++ b/src/hotspot/os/aix/os_aix.cpp	Thu Sep 07 15:40:20 2017 +0200
@@ -889,8 +889,12 @@
                             stack_size / K);
   }
 
-  // Configure libc guard page.
-  ret = pthread_attr_setguardsize(&attr, os::Aix::default_guard_size(thr_type));
+  // Save some cycles and a page by disabling OS guard pages where we have our own
+  // VM guard pages (in java threads). For other threads, keep system default guard
+  // pages in place.
+  if (thr_type == java_thread || thr_type == compiler_thread) {
+    ret = pthread_attr_setguardsize(&attr, 0);
+  }
 
   pthread_t tid = 0;
   if (ret == 0) {
@@ -3019,19 +3023,6 @@
   return chained;
 }
 
-size_t os::Aix::default_guard_size(os::ThreadType thr_type) {
-  // Creating guard page is very expensive. Java thread has HotSpot
-  // guard pages, only enable glibc guard page for non-Java threads.
-  // (Remember: compiler thread is a Java thread, too!)
-  //
-  // Aix can have different page sizes for stack (4K) and heap (64K).
-  // As Hotspot knows only one page size, we assume the stack has
-  // the same page size as the heap. Returning page_size() here can
-  // cause 16 guard pages which we want to avoid.  Thus we return 4K
-  // which will be rounded to the real page size by the OS.
-  return ((thr_type == java_thread || thr_type == compiler_thread) ? 0 : 4 * K);
-}
-
 struct sigaction* os::Aix::get_preinstalled_handler(int sig) {
   if (sigismember(&sigs, sig)) {
     return &sigact[sig];
--- a/src/hotspot/os/aix/os_aix.hpp	Tue Oct 17 20:21:50 2017 -0400
+++ b/src/hotspot/os/aix/os_aix.hpp	Thu Sep 07 15:40:20 2017 +0200
@@ -139,9 +139,6 @@
   // libpthread version string
   static void libpthread_init();
 
-  // Return default libc guard size for the specified thread type.
-  static size_t default_guard_size(os::ThreadType thr_type);
-
   // Function returns true if we run on OS/400 (pase), false if we run
   // on AIX.
   static bool on_pase() {