Mercurial > hg > graal-jvmci-8
comparison src/os/linux/vm/os_linux.cpp @ 10164:b4081e9714ec
8013398: Adjust number of stack guard pages on systems with large memory page size
Summary: Auto adjust number of stack guard pages on systems with large memory page size
Reviewed-by: bobv, coleenp
author | vladidan |
---|---|
date | Tue, 30 Apr 2013 17:36:01 -0400 |
parents | f32b6c267d2e |
children | 9ce110b1d14a |
comparison
equal
deleted
inserted
replaced
10160:ed5a590835a4 | 10164:b4081e9714ec |
---|---|
117 int (*os::Linux::_clock_gettime)(clockid_t, struct timespec *) = NULL; | 117 int (*os::Linux::_clock_gettime)(clockid_t, struct timespec *) = NULL; |
118 int (*os::Linux::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL; | 118 int (*os::Linux::_pthread_getcpuclockid)(pthread_t, clockid_t *) = NULL; |
119 Mutex* os::Linux::_createThread_lock = NULL; | 119 Mutex* os::Linux::_createThread_lock = NULL; |
120 pthread_t os::Linux::_main_thread; | 120 pthread_t os::Linux::_main_thread; |
121 int os::Linux::_page_size = -1; | 121 int os::Linux::_page_size = -1; |
122 const int os::Linux::_vm_default_page_size = (8 * K); | |
122 bool os::Linux::_is_floating_stack = false; | 123 bool os::Linux::_is_floating_stack = false; |
123 bool os::Linux::_is_NPTL = false; | 124 bool os::Linux::_is_NPTL = false; |
124 bool os::Linux::_supports_fast_thread_cpu_time = false; | 125 bool os::Linux::_supports_fast_thread_cpu_time = false; |
125 const char * os::Linux::_glibc_version = NULL; | 126 const char * os::Linux::_glibc_version = NULL; |
126 const char * os::Linux::_libpthread_version = NULL; | 127 const char * os::Linux::_libpthread_version = NULL; |
4248 Linux::_main_thread = pthread_self(); | 4249 Linux::_main_thread = pthread_self(); |
4249 | 4250 |
4250 Linux::clock_init(); | 4251 Linux::clock_init(); |
4251 initial_time_count = os::elapsed_counter(); | 4252 initial_time_count = os::elapsed_counter(); |
4252 pthread_mutex_init(&dl_mutex, NULL); | 4253 pthread_mutex_init(&dl_mutex, NULL); |
4254 | |
4255 // If the pagesize of the VM is greater than 8K determine the appropriate | |
4256 // number of initial guard pages. The user can change this with the | |
4257 // command line arguments, if needed. | |
4258 if (vm_page_size() > (int)Linux::vm_default_page_size()) { | |
4259 StackYellowPages = 1; | |
4260 StackRedPages = 1; | |
4261 StackShadowPages = round_to((StackShadowPages*Linux::vm_default_page_size()), vm_page_size()) / vm_page_size(); | |
4262 } | |
4253 } | 4263 } |
4254 | 4264 |
4255 // To install functions for atexit system call | 4265 // To install functions for atexit system call |
4256 extern "C" { | 4266 extern "C" { |
4257 static void perfMemory_exit_helper() { | 4267 static void perfMemory_exit_helper() { |
4301 // the java system classes, including StackOverflowError - depends on page | 4311 // the java system classes, including StackOverflowError - depends on page |
4302 // size. Add a page for compiler2 recursion in main thread. | 4312 // size. Add a page for compiler2 recursion in main thread. |
4303 // Add in 2*BytesPerWord times page size to account for VM stack during | 4313 // Add in 2*BytesPerWord times page size to account for VM stack during |
4304 // class initialization depending on 32 or 64 bit VM. | 4314 // class initialization depending on 32 or 64 bit VM. |
4305 os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed, | 4315 os::Linux::min_stack_allowed = MAX2(os::Linux::min_stack_allowed, |
4306 (size_t)(StackYellowPages+StackRedPages+StackShadowPages+ | 4316 (size_t)(StackYellowPages+StackRedPages+StackShadowPages) * Linux::page_size() + |
4307 2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::page_size()); | 4317 (2*BytesPerWord COMPILER2_PRESENT(+1)) * Linux::vm_default_page_size()); |
4308 | 4318 |
4309 size_t threadStackSizeInBytes = ThreadStackSize * K; | 4319 size_t threadStackSizeInBytes = ThreadStackSize * K; |
4310 if (threadStackSizeInBytes != 0 && | 4320 if (threadStackSizeInBytes != 0 && |
4311 threadStackSizeInBytes < os::Linux::min_stack_allowed) { | 4321 threadStackSizeInBytes < os::Linux::min_stack_allowed) { |
4312 tty->print_cr("\nThe stack size specified is too small, " | 4322 tty->print_cr("\nThe stack size specified is too small, " |