< prev index next >

src/os_cpu/linux_s390/vm/os_linux_s390.cpp

Print this page
rev 12363 : 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, kvn

*** 471,577 **** } //////////////////////////////////////////////////////////////////////////////// // thread stack size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K; ! size_t os::Posix::_java_thread_min_stack_allowed = 128 * K; size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K; ! // return default stack size for thr_type size_t os::Posix::default_stack_size(os::ThreadType thr_type) { ! // default stack size (compiler thread needs larger stack) 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) { - // z/Architecture: put 2 guard pages right in the middle of thread stack. This value - // should be consistent with the value used by register stack handling code. - return 2 * page_size(); - } - - // Java thread: - // - // Low memory addresses - // +------------------------+ - // | |\ - // | glibc guard page | - Right in the middle of stack, 2 pages - // | |/ - // P1 +------------------------+ Thread::stack_base() - Thread::stack_size() - // | |\ - // | HotSpot Guard Pages | - red and yellow pages - // | |/ - // +------------------------+ JavaThread::stack_yellow_zone_base() - // | |\ - // | Normal Stack | - - // | |/ - // P2 +------------------------+ Thread::stack_base() - // - // Non-Java thread: - // - // Low memory addresses - // +------------------------+ - // | |\ - // | glibc guard page | - Right in the middle of stack, 2 pages - // | |/ - // P1 +------------------------+ Thread::stack_base() - Thread::stack_size() - // | |\ - // | Normal Stack | - - // | |/ - // P2 +------------------------+ Thread::stack_base() - // - // ** P2 is the address returned from pthread_attr_getstackaddr(), P2 - P1 - // is the stack size returned by pthread_attr_getstacksize(). - - - static void current_stack_region(address * bottom, size_t * size) { - if (os::Linux::is_initial_thread()) { - // Initial thread needs special handling because pthread_getattr_np() - // may return bogus value. - *bottom = os::Linux::initial_thread_stack_bottom(); - *size = os::Linux::initial_thread_stack_size(); - } else { - pthread_attr_t attr; - - int rslt = pthread_getattr_np(pthread_self(), &attr); - - // JVM needs to know exact stack location, abort if it fails - if (rslt != 0) { - if (rslt == ENOMEM) { - vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); - } else { - fatal("pthread_getattr_np failed with errno = %d", rslt); - } - } - - if (pthread_attr_getstack(&attr, (void **)bottom, size) != 0) { - fatal("Can not locate current stack attributes!"); - } - - pthread_attr_destroy(&attr); - - } - assert(os::current_stack_pointer() >= *bottom && - os::current_stack_pointer() < *bottom + *size, "just checking"); - } - - address os::current_stack_base() { - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return (bottom + size); - } - - size_t os::current_stack_size() { - // stack size includes normal stack and HotSpot guard pages - address bottom; - size_t size; - current_stack_region(&bottom, &size); - return size; - } - ///////////////////////////////////////////////////////////////////////////// // helper functions for fatal error handler void os::print_context(outputStream *st, const void *context) { if (context == NULL) return; --- 471,493 ---- } //////////////////////////////////////////////////////////////////////////////// // thread stack + // These sizes exclude libc stack guard pages, but include + // the HotSpot guard pages. size_t os::Posix::_compiler_thread_min_stack_allowed = 128 * K; ! size_t os::Posix::_java_thread_min_stack_allowed = 236 * K; size_t os::Posix::_vm_internal_thread_min_stack_allowed = 128 * K; ! // Return default stack size for thr_type. size_t os::Posix::default_stack_size(os::ThreadType thr_type) { ! // Default stack size (compiler thread needs larger stack). size_t s = (thr_type == os::compiler_thread ? 4 * M : 1024 * K); return s; } ///////////////////////////////////////////////////////////////////////////// // helper functions for fatal error handler void os::print_context(outputStream *st, const void *context) { if (context == NULL) return;
< prev index next >