< prev index next >

src/os_cpu/linux_ppc/vm/os_linux_ppc.cpp

Print this page
rev 12305 : 8169373: Work around linux NPTL stack guard error.
Summary: Also streamline OS guard page handling on linuxs390, linuxppc, aixppc.

@@ -545,11 +545,13 @@
   size_t s = (thr_type == os::compiler_thread ? 4 * M : 1024 * K);
   return s;
 }
 
 size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
-  return 2 * page_size();
+  // Creating guard page is very expensive. Java thread has HotSpot
+  // guard page, only enable glibc guard page for non-Java threads.
+  return (thr_type == java_thread ? 0 : page_size());
 }
 
 // Java thread:
 //
 //   Low memory addresses

@@ -605,10 +607,16 @@
 
     if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) {
       fatal("Can not locate current stack attributes!");
     }
 
+    // Work around NPTL stack guard error.
+    size_t guard_size = 0;
+    pthread_attr_getguardsize(&attr, &guard_size);
+    *bottom += guard_size;
+    *size   -= guard_size;
+    
     pthread_attr_destroy(&attr);
 
   }
   assert(os::current_stack_pointer() >= *bottom &&
          os::current_stack_pointer() < *bottom + *size, "just checking");
< prev index next >