< prev index next >

src/os_cpu/linux_zero/vm/os_linux_zero.cpp

Print this page
rev 12346 : 8169373: Work around linux NPTL stack guard error.
Summary: Also skip libc guard page for compiler thread, merge similar code on linux platforms, and streamline libc guard page handling on linuxs390, linuxppc, aixppc.
Reviewed-by: dholmes, dcubed


 303   return addr != NULL;
 304 #endif // _LP64
 305 }
 306 
 307 ///////////////////////////////////////////////////////////////////////////////
 308 // thread stack
 309 
 310 size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K;
 311 size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
 312 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
 313 
 314 size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
 315 #ifdef _LP64
 316   size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
 317 #else
 318   size_t s = (thr_type == os::compiler_thread ? 2 * M : 512 * K);
 319 #endif // _LP64
 320   return s;
 321 }
 322 
 323 size_t os::Linux::default_guard_size(os::ThreadType thr_type) {
 324   // Only enable glibc guard pages for non-Java threads
 325   // (Java threads have HotSpot guard pages)
 326   return (thr_type == java_thread ? 0 : page_size());
 327 }
 328 
 329 static void current_stack_region(address *bottom, size_t *size) {
 330   pthread_attr_t attr;
 331   int res = pthread_getattr_np(pthread_self(), &attr);
 332   if (res != 0) {
 333     if (res == ENOMEM) {
 334       vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
 335     }
 336     else {
 337       fatal("pthread_getattr_np failed with errno = %d", res);
 338     }
 339   }
 340 
 341   address stack_bottom;
 342   size_t stack_bytes;
 343   res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes);
 344   if (res != 0) {
 345     fatal("pthread_attr_getstack failed with errno = %d", res);
 346   }
 347   address stack_top = stack_bottom + stack_bytes;
 348 




 303   return addr != NULL;
 304 #endif // _LP64
 305 }
 306 
 307 ///////////////////////////////////////////////////////////////////////////////
 308 // thread stack
 309 
 310 size_t os::Posix::_compiler_thread_min_stack_allowed = 64 * K;
 311 size_t os::Posix::_java_thread_min_stack_allowed = 64 * K;
 312 size_t os::Posix::_vm_internal_thread_min_stack_allowed = 64 * K;
 313 
 314 size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
 315 #ifdef _LP64
 316   size_t s = (thr_type == os::compiler_thread ? 4 * M : 1 * M);
 317 #else
 318   size_t s = (thr_type == os::compiler_thread ? 2 * M : 512 * K);
 319 #endif // _LP64
 320   return s;
 321 }
 322 






 323 static void current_stack_region(address *bottom, size_t *size) {
 324   pthread_attr_t attr;
 325   int res = pthread_getattr_np(pthread_self(), &attr);
 326   if (res != 0) {
 327     if (res == ENOMEM) {
 328       vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np");
 329     }
 330     else {
 331       fatal("pthread_getattr_np failed with errno = %d", res);
 332     }
 333   }
 334 
 335   address stack_bottom;
 336   size_t stack_bytes;
 337   res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes);
 338   if (res != 0) {
 339     fatal("pthread_attr_getstack failed with errno = %d", res);
 340   }
 341   address stack_top = stack_bottom + stack_bytes;
 342 


< prev index next >