8055479: TLAB stability

Reviewed-by: brutisso, stefank, ahgross
This commit is contained in:
Mikael Gerdin 2014-10-09 15:42:23 +02:00
parent 72a9a49cfb
commit 8daca859f8
5 changed files with 18 additions and 10 deletions

View file

@ -235,22 +235,19 @@ void ThreadLocalAllocBuffer::startup_initialization() {
}
size_t ThreadLocalAllocBuffer::initial_desired_size() {
size_t init_sz;
size_t init_sz = 0;
if (TLABSize > 0) {
init_sz = MIN2(TLABSize / HeapWordSize, max_size());
} else if (global_stats() == NULL) {
// Startup issue - main thread initialized before heap initialized.
init_sz = min_size();
} else {
init_sz = TLABSize / HeapWordSize;
} else if (global_stats() != NULL) {
// Initial size is a function of the average number of allocating threads.
unsigned nof_threads = global_stats()->allocating_threads_avg();
init_sz = (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) /
(nof_threads * target_refills());
init_sz = align_object_size(init_sz);
init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
}
init_sz = MIN2(MAX2(init_sz, min_size()), max_size());
return init_sz;
}