8187028: [aix] Real thread stack size may be up to 64K smaller than requested one
Reviewed-by: goetz
This commit is contained in:
parent
195531f733
commit
2f137ced94
@ -770,8 +770,15 @@ static void *thread_native_entry(Thread *thread) {
|
|||||||
const pthread_t pthread_id = ::pthread_self();
|
const pthread_t pthread_id = ::pthread_self();
|
||||||
const tid_t kernel_thread_id = ::thread_self();
|
const tid_t kernel_thread_id = ::thread_self();
|
||||||
|
|
||||||
log_info(os, thread)("Thread is alive (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT ").",
|
LogTarget(Info, os, thread) lt;
|
||||||
os::current_thread_id(), (uintx) kernel_thread_id);
|
if (lt.is_enabled()) {
|
||||||
|
address low_address = thread->stack_end();
|
||||||
|
address high_address = thread->stack_base();
|
||||||
|
lt.print("Thread is alive (tid: " UINTX_FORMAT ", kernel thread id: " UINTX_FORMAT
|
||||||
|
", stack [" PTR_FORMAT " - " PTR_FORMAT " (" SIZE_FORMAT "k using %uk pages)).",
|
||||||
|
os::current_thread_id(), (uintx) kernel_thread_id, low_address, high_address,
|
||||||
|
(high_address - low_address) / K, os::Aix::query_pagesize(low_address) / K);
|
||||||
|
}
|
||||||
|
|
||||||
// Normally, pthread stacks on AIX live in the data segment (are allocated with malloc()
|
// Normally, pthread stacks on AIX live in the data segment (are allocated with malloc()
|
||||||
// by the pthread library). In rare cases, this may not be the case, e.g. when third-party
|
// by the pthread library). In rare cases, this may not be the case, e.g. when third-party
|
||||||
@ -864,6 +871,14 @@ bool os::create_thread(Thread* thread, ThreadType thr_type,
|
|||||||
// Calculate stack size if it's not specified by caller.
|
// Calculate stack size if it's not specified by caller.
|
||||||
size_t stack_size = os::Posix::get_initial_stack_size(thr_type, req_stack_size);
|
size_t stack_size = os::Posix::get_initial_stack_size(thr_type, req_stack_size);
|
||||||
|
|
||||||
|
// JDK-8187028: It was observed that on some configurations (4K backed thread stacks)
|
||||||
|
// the real thread stack size may be smaller than the requested stack size, by as much as 64K.
|
||||||
|
// This very much looks like a pthread lib error. As a workaround, increase the stack size
|
||||||
|
// by 64K for small thread stacks (arbitrarily choosen to be < 4MB)
|
||||||
|
if (stack_size < 4096 * K) {
|
||||||
|
stack_size += 64 * K;
|
||||||
|
}
|
||||||
|
|
||||||
// On Aix, pthread_attr_setstacksize fails with huge values and leaves the
|
// On Aix, pthread_attr_setstacksize fails with huge values and leaves the
|
||||||
// thread size in attr unchanged. If this is the minimal stack size as set
|
// thread size in attr unchanged. If this is the minimal stack size as set
|
||||||
// by pthread_attr_init this leads to crashes after thread creation. E.g. the
|
// by pthread_attr_init this leads to crashes after thread creation. E.g. the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user