< prev index next >

src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp

Print this page
rev 53608 : TLAB fast refill cleanup

*** 1,7 **** /* ! * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 74,88 **** } stats->update_fast_allocations(_number_of_refills, _allocated_size, _gc_waste, ! _fast_refill_waste, ! _slow_refill_waste); } else { ! assert(_number_of_refills == 0 && _fast_refill_waste == 0 && ! _slow_refill_waste == 0 && _gc_waste == 0, "tlab stats == 0"); } stats->update_slow_allocations(_slow_allocations); --- 74,86 ---- } stats->update_fast_allocations(_number_of_refills, _allocated_size, _gc_waste, ! _refill_waste); } else { ! assert(_number_of_refills == 0 && _refill_waste == 0 && _gc_waste == 0, "tlab stats == 0"); } stats->update_slow_allocations(_slow_allocations);
*** 119,129 **** initialize(NULL, NULL, NULL); } } void ThreadLocalAllocBuffer::retire_before_allocation() { ! _slow_refill_waste += (unsigned int)remaining(); retire(); } void ThreadLocalAllocBuffer::resize() { // Compute the next tlab size using expected allocation amount --- 117,127 ---- initialize(NULL, NULL, NULL); } } void ThreadLocalAllocBuffer::retire_before_allocation() { ! _refill_waste += (unsigned int)remaining(); retire(); } void ThreadLocalAllocBuffer::resize() { // Compute the next tlab size using expected allocation amount
*** 145,156 **** set_refill_waste_limit(initial_refill_waste_limit()); } void ThreadLocalAllocBuffer::reset_statistics() { _number_of_refills = 0; ! _fast_refill_waste = 0; ! _slow_refill_waste = 0; _gc_waste = 0; _slow_allocations = 0; _allocated_size = 0; } --- 143,153 ---- set_refill_waste_limit(initial_refill_waste_limit()); } void ThreadLocalAllocBuffer::reset_statistics() { _number_of_refills = 0; ! _refill_waste = 0; _gc_waste = 0; _slow_allocations = 0; _allocated_size = 0; }
*** 260,286 **** if (!log.is_trace()) { return; } Thread* thrd = thread(); ! size_t waste = _gc_waste + _slow_refill_waste + _fast_refill_waste; double waste_percent = percent_of(waste, _allocated_size); size_t tlab_used = Universe::heap()->tlab_used(thrd); log.trace("TLAB: %s thread: " INTPTR_FORMAT " [id: %2d]" " desired_size: " SIZE_FORMAT "KB" " slow allocs: %d refill waste: " SIZE_FORMAT "B" " alloc:%8.5f %8.0fKB refills: %d waste %4.1f%% gc: %dB" ! " slow: %dB fast: %dB", tag, p2i(thrd), thrd->osthread()->thread_id(), _desired_size / (K / HeapWordSize), _slow_allocations, _refill_waste_limit * HeapWordSize, _allocation_fraction.average(), _allocation_fraction.average() * tlab_used / K, _number_of_refills, waste_percent, _gc_waste * HeapWordSize, ! _slow_refill_waste * HeapWordSize, ! _fast_refill_waste * HeapWordSize); } void ThreadLocalAllocBuffer::set_sample_end() { size_t heap_words_remaining = pointer_delta(_end, _top); size_t bytes_until_sample = thread()->heap_sampler().bytes_until_sample(); --- 257,282 ---- if (!log.is_trace()) { return; } Thread* thrd = thread(); ! size_t waste = _gc_waste + _refill_waste; double waste_percent = percent_of(waste, _allocated_size); size_t tlab_used = Universe::heap()->tlab_used(thrd); log.trace("TLAB: %s thread: " INTPTR_FORMAT " [id: %2d]" " desired_size: " SIZE_FORMAT "KB" " slow allocs: %d refill waste: " SIZE_FORMAT "B" " alloc:%8.5f %8.0fKB refills: %d waste %4.1f%% gc: %dB" ! " refill: %dB", tag, p2i(thrd), thrd->osthread()->thread_id(), _desired_size / (K / HeapWordSize), _slow_allocations, _refill_waste_limit * HeapWordSize, _allocation_fraction.average(), _allocation_fraction.average() * tlab_used / K, _number_of_refills, waste_percent, _gc_waste * HeapWordSize, ! _refill_waste * HeapWordSize); } void ThreadLocalAllocBuffer::set_sample_end() { size_t heap_words_remaining = pointer_delta(_end, _top); size_t bytes_until_sample = thread()->heap_sampler().bytes_until_sample();
*** 311,324 **** PerfVariable* ThreadLocalAllocStats::_perf_total_refills; PerfVariable* ThreadLocalAllocStats::_perf_max_refills; PerfVariable* ThreadLocalAllocStats::_perf_total_allocations; PerfVariable* ThreadLocalAllocStats::_perf_total_gc_waste; PerfVariable* ThreadLocalAllocStats::_perf_max_gc_waste; ! PerfVariable* ThreadLocalAllocStats::_perf_total_slow_refill_waste; ! PerfVariable* ThreadLocalAllocStats::_perf_max_slow_refill_waste; ! PerfVariable* ThreadLocalAllocStats::_perf_total_fast_refill_waste; ! PerfVariable* ThreadLocalAllocStats::_perf_max_fast_refill_waste; PerfVariable* ThreadLocalAllocStats::_perf_total_slow_allocations; PerfVariable* ThreadLocalAllocStats::_perf_max_slow_allocations; AdaptiveWeightedAverage ThreadLocalAllocStats::_allocating_threads_avg(0); static PerfVariable* create_perf_variable(const char* name, PerfData::Units unit, TRAPS) { --- 307,318 ---- PerfVariable* ThreadLocalAllocStats::_perf_total_refills; PerfVariable* ThreadLocalAllocStats::_perf_max_refills; PerfVariable* ThreadLocalAllocStats::_perf_total_allocations; PerfVariable* ThreadLocalAllocStats::_perf_total_gc_waste; PerfVariable* ThreadLocalAllocStats::_perf_max_gc_waste; ! PerfVariable* ThreadLocalAllocStats::_perf_total_refill_waste; ! PerfVariable* ThreadLocalAllocStats::_perf_max_refill_waste; PerfVariable* ThreadLocalAllocStats::_perf_total_slow_allocations; PerfVariable* ThreadLocalAllocStats::_perf_max_slow_allocations; AdaptiveWeightedAverage ThreadLocalAllocStats::_allocating_threads_avg(0); static PerfVariable* create_perf_variable(const char* name, PerfData::Units unit, TRAPS) {
*** 336,349 **** _perf_total_refills = create_perf_variable("fills", PerfData::U_None, CHECK); _perf_max_refills = create_perf_variable("maxFills", PerfData::U_None, CHECK); _perf_total_allocations = create_perf_variable("alloc", PerfData::U_Bytes, CHECK); _perf_total_gc_waste = create_perf_variable("gcWaste", PerfData::U_Bytes, CHECK); _perf_max_gc_waste = create_perf_variable("maxGcWaste", PerfData::U_Bytes, CHECK); ! _perf_total_slow_refill_waste = create_perf_variable("slowWaste", PerfData::U_Bytes, CHECK); ! _perf_max_slow_refill_waste = create_perf_variable("maxSlowWaste", PerfData::U_Bytes, CHECK); ! _perf_total_fast_refill_waste = create_perf_variable("fastWaste", PerfData::U_Bytes, CHECK); ! _perf_max_fast_refill_waste = create_perf_variable("maxFastWaste", PerfData::U_Bytes, CHECK); _perf_total_slow_allocations = create_perf_variable("slowAlloc", PerfData::U_None, CHECK); _perf_max_slow_allocations = create_perf_variable("maxSlowAlloc", PerfData::U_None, CHECK); } } --- 330,341 ---- _perf_total_refills = create_perf_variable("fills", PerfData::U_None, CHECK); _perf_max_refills = create_perf_variable("maxFills", PerfData::U_None, CHECK); _perf_total_allocations = create_perf_variable("alloc", PerfData::U_Bytes, CHECK); _perf_total_gc_waste = create_perf_variable("gcWaste", PerfData::U_Bytes, CHECK); _perf_max_gc_waste = create_perf_variable("maxGcWaste", PerfData::U_Bytes, CHECK); ! _perf_total_refill_waste = create_perf_variable("refillWaste", PerfData::U_Bytes, CHECK); ! _perf_max_refill_waste = create_perf_variable("maxRefillWaste", PerfData::U_Bytes, CHECK); _perf_total_slow_allocations = create_perf_variable("slowAlloc", PerfData::U_None, CHECK); _perf_max_slow_allocations = create_perf_variable("maxSlowAlloc", PerfData::U_None, CHECK); } }
*** 352,387 **** _total_refills(0), _max_refills(0), _total_allocations(0), _total_gc_waste(0), _max_gc_waste(0), ! _total_fast_refill_waste(0), ! _max_fast_refill_waste(0), ! _total_slow_refill_waste(0), ! _max_slow_refill_waste(0), _total_slow_allocations(0), _max_slow_allocations(0) {} unsigned int ThreadLocalAllocStats::allocating_threads_avg() { return MAX2((unsigned int)(_allocating_threads_avg.average() + 0.5), 1U); } void ThreadLocalAllocStats::update_fast_allocations(unsigned int refills, size_t allocations, size_t gc_waste, ! size_t fast_refill_waste, ! size_t slow_refill_waste) { _allocating_threads += 1; _total_refills += refills; _max_refills = MAX2(_max_refills, refills); _total_allocations += allocations; _total_gc_waste += gc_waste; _max_gc_waste = MAX2(_max_gc_waste, gc_waste); ! _total_fast_refill_waste += fast_refill_waste; ! _max_fast_refill_waste = MAX2(_max_fast_refill_waste, fast_refill_waste); ! _total_slow_refill_waste += slow_refill_waste; ! _max_slow_refill_waste = MAX2(_max_slow_refill_waste, slow_refill_waste); } void ThreadLocalAllocStats::update_slow_allocations(unsigned int allocations) { _total_slow_allocations += allocations; _max_slow_allocations = MAX2(_max_slow_allocations, allocations); --- 344,374 ---- _total_refills(0), _max_refills(0), _total_allocations(0), _total_gc_waste(0), _max_gc_waste(0), ! _total_refill_waste(0), ! _max_refill_waste(0), _total_slow_allocations(0), _max_slow_allocations(0) {} unsigned int ThreadLocalAllocStats::allocating_threads_avg() { return MAX2((unsigned int)(_allocating_threads_avg.average() + 0.5), 1U); } void ThreadLocalAllocStats::update_fast_allocations(unsigned int refills, size_t allocations, size_t gc_waste, ! size_t refill_waste) { _allocating_threads += 1; _total_refills += refills; _max_refills = MAX2(_max_refills, refills); _total_allocations += allocations; _total_gc_waste += gc_waste; _max_gc_waste = MAX2(_max_gc_waste, gc_waste); ! _total_refill_waste += refill_waste; ! _max_refill_waste = MAX2(_max_refill_waste, refill_waste); } void ThreadLocalAllocStats::update_slow_allocations(unsigned int allocations) { _total_slow_allocations += allocations; _max_slow_allocations = MAX2(_max_slow_allocations, allocations);
*** 392,405 **** _total_refills += other._total_refills; _max_refills = MAX2(_max_refills, other._max_refills); _total_allocations += other._total_allocations; _total_gc_waste += other._total_gc_waste; _max_gc_waste = MAX2(_max_gc_waste, other._max_gc_waste); ! _total_fast_refill_waste += other._total_fast_refill_waste; ! _max_fast_refill_waste = MAX2(_max_fast_refill_waste, other._max_fast_refill_waste); ! _total_slow_refill_waste += other._total_slow_refill_waste; ! _max_slow_refill_waste = MAX2(_max_slow_refill_waste, other._max_slow_refill_waste); _total_slow_allocations += other._total_slow_allocations; _max_slow_allocations = MAX2(_max_slow_allocations, other._max_slow_allocations); } void ThreadLocalAllocStats::reset() { --- 379,390 ---- _total_refills += other._total_refills; _max_refills = MAX2(_max_refills, other._max_refills); _total_allocations += other._total_allocations; _total_gc_waste += other._total_gc_waste; _max_gc_waste = MAX2(_max_gc_waste, other._max_gc_waste); ! _total_refill_waste += other._total_refill_waste; ! _max_refill_waste = MAX2(_max_refill_waste, other._max_refill_waste); _total_slow_allocations += other._total_slow_allocations; _max_slow_allocations = MAX2(_max_slow_allocations, other._max_slow_allocations); } void ThreadLocalAllocStats::reset() {
*** 407,420 **** _total_refills = 0; _max_refills = 0; _total_allocations = 0; _total_gc_waste = 0; _max_gc_waste = 0; ! _total_fast_refill_waste = 0; ! _max_fast_refill_waste = 0; ! _total_slow_refill_waste = 0; ! _max_slow_refill_waste = 0; _total_slow_allocations = 0; _max_slow_allocations = 0; } void ThreadLocalAllocStats::publish() { --- 392,403 ---- _total_refills = 0; _max_refills = 0; _total_allocations = 0; _total_gc_waste = 0; _max_gc_waste = 0; ! _total_refill_waste = 0; ! _max_refill_waste = 0; _total_slow_allocations = 0; _max_slow_allocations = 0; } void ThreadLocalAllocStats::publish() {
*** 422,455 **** return; } _allocating_threads_avg.sample(_allocating_threads); ! const size_t waste = _total_gc_waste + _total_slow_refill_waste + _total_fast_refill_waste; const double waste_percent = percent_of(waste, _total_allocations); log_debug(gc, tlab)("TLAB totals: thrds: %d refills: %d max: %d" " slow allocs: %d max %d waste: %4.1f%%" " gc: " SIZE_FORMAT "B max: " SIZE_FORMAT "B" ! " slow: " SIZE_FORMAT "B max: " SIZE_FORMAT "B" ! " fast: " SIZE_FORMAT "B max: " SIZE_FORMAT "B", _allocating_threads, _total_refills, _max_refills, _total_slow_allocations, _max_slow_allocations, waste_percent, _total_gc_waste * HeapWordSize, _max_gc_waste * HeapWordSize, ! _total_slow_refill_waste * HeapWordSize, _max_slow_refill_waste * HeapWordSize, ! _total_fast_refill_waste * HeapWordSize, _max_fast_refill_waste * HeapWordSize); if (UsePerfData) { _perf_allocating_threads ->set_value(_allocating_threads); _perf_total_refills ->set_value(_total_refills); _perf_max_refills ->set_value(_max_refills); _perf_total_allocations ->set_value(_total_allocations); _perf_total_gc_waste ->set_value(_total_gc_waste); _perf_max_gc_waste ->set_value(_max_gc_waste); ! _perf_total_slow_refill_waste ->set_value(_total_slow_refill_waste); ! _perf_max_slow_refill_waste ->set_value(_max_slow_refill_waste); ! _perf_total_fast_refill_waste ->set_value(_total_fast_refill_waste); ! _perf_max_fast_refill_waste ->set_value(_max_fast_refill_waste); _perf_total_slow_allocations ->set_value(_total_slow_allocations); _perf_max_slow_allocations ->set_value(_max_slow_allocations); } } --- 405,434 ---- return; } _allocating_threads_avg.sample(_allocating_threads); ! const size_t waste = _total_gc_waste + _total_refill_waste; const double waste_percent = percent_of(waste, _total_allocations); log_debug(gc, tlab)("TLAB totals: thrds: %d refills: %d max: %d" " slow allocs: %d max %d waste: %4.1f%%" " gc: " SIZE_FORMAT "B max: " SIZE_FORMAT "B" ! " refill: " SIZE_FORMAT "B max: " SIZE_FORMAT "B", _allocating_threads, _total_refills, _max_refills, _total_slow_allocations, _max_slow_allocations, waste_percent, _total_gc_waste * HeapWordSize, _max_gc_waste * HeapWordSize, ! _total_refill_waste * HeapWordSize, _max_refill_waste * HeapWordSize); if (UsePerfData) { _perf_allocating_threads ->set_value(_allocating_threads); _perf_total_refills ->set_value(_total_refills); _perf_max_refills ->set_value(_max_refills); _perf_total_allocations ->set_value(_total_allocations); _perf_total_gc_waste ->set_value(_total_gc_waste); _perf_max_gc_waste ->set_value(_max_gc_waste); ! _perf_total_refill_waste ->set_value(_total_refill_waste); ! _perf_max_refill_waste ->set_value(_max_refill_waste); _perf_total_slow_allocations ->set_value(_total_slow_allocations); _perf_max_slow_allocations ->set_value(_max_slow_allocations); } }
< prev index next >