# HG changeset patch # User zgu # Date 1549547483 18000 # Thu Feb 07 08:51:23 2019 -0500 # Node ID 4ce64456796d0b66bc56cde7a051abe91ec3df2f # Parent 3f054fd8564684b2fb6cc20f3807aae84e940114 TLAB fast refill cleanup diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. + * 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 @@ -76,11 +76,9 @@ stats->update_fast_allocations(_number_of_refills, _allocated_size, _gc_waste, - _fast_refill_waste, - _slow_refill_waste); + _refill_waste); } else { - assert(_number_of_refills == 0 && _fast_refill_waste == 0 && - _slow_refill_waste == 0 && _gc_waste == 0, + assert(_number_of_refills == 0 && _refill_waste == 0 && _gc_waste == 0, "tlab stats == 0"); } @@ -121,7 +119,7 @@ } void ThreadLocalAllocBuffer::retire_before_allocation() { - _slow_refill_waste += (unsigned int)remaining(); + _refill_waste += (unsigned int)remaining(); retire(); } @@ -147,8 +145,7 @@ void ThreadLocalAllocBuffer::reset_statistics() { _number_of_refills = 0; - _fast_refill_waste = 0; - _slow_refill_waste = 0; + _refill_waste = 0; _gc_waste = 0; _slow_allocations = 0; _allocated_size = 0; @@ -262,14 +259,14 @@ } Thread* thrd = thread(); - size_t waste = _gc_waste + _slow_refill_waste + _fast_refill_waste; + 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" - " slow: %dB fast: %dB", + " refill: %dB", tag, p2i(thrd), thrd->osthread()->thread_id(), _desired_size / (K / HeapWordSize), _slow_allocations, _refill_waste_limit * HeapWordSize, @@ -277,8 +274,7 @@ _allocation_fraction.average() * tlab_used / K, _number_of_refills, waste_percent, _gc_waste * HeapWordSize, - _slow_refill_waste * HeapWordSize, - _fast_refill_waste * HeapWordSize); + _refill_waste * HeapWordSize); } void ThreadLocalAllocBuffer::set_sample_end() { @@ -313,10 +309,8 @@ 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_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); @@ -332,18 +326,16 @@ if (UsePerfData) { EXCEPTION_MARK; - _perf_allocating_threads = create_perf_variable("allocThreads", PerfData::U_None, CHECK); - _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); + _perf_allocating_threads = create_perf_variable("allocThreads", PerfData::U_None, CHECK); + _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); } } @@ -354,10 +346,8 @@ _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_refill_waste(0), + _max_refill_waste(0), _total_slow_allocations(0), _max_slow_allocations(0) {} @@ -368,18 +358,15 @@ 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) { + 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_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); + _total_refill_waste += refill_waste; + _max_refill_waste = MAX2(_max_refill_waste, refill_waste); } void ThreadLocalAllocStats::update_slow_allocations(unsigned int allocations) { @@ -394,10 +381,8 @@ _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_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); } @@ -409,10 +394,8 @@ _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_refill_waste = 0; + _max_refill_waste = 0; _total_slow_allocations = 0; _max_slow_allocations = 0; } @@ -424,18 +407,16 @@ _allocating_threads_avg.sample(_allocating_threads); - const size_t waste = _total_gc_waste + _total_slow_refill_waste + _total_fast_refill_waste; + 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" - " slow: " SIZE_FORMAT "B max: " SIZE_FORMAT "B" - " fast: " 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_slow_refill_waste * HeapWordSize, _max_slow_refill_waste * HeapWordSize, - _total_fast_refill_waste * HeapWordSize, _max_fast_refill_waste * HeapWordSize); + _total_refill_waste * HeapWordSize, _max_refill_waste * HeapWordSize); if (UsePerfData) { _perf_allocating_threads ->set_value(_allocating_threads); @@ -444,10 +425,8 @@ _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_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); } diff --git a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp --- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp +++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp @@ -62,8 +62,7 @@ static unsigned _target_refills; // expected number of refills between GCs unsigned _number_of_refills; - unsigned _fast_refill_waste; - unsigned _slow_refill_waste; + unsigned _refill_waste; unsigned _gc_waste; unsigned _slow_allocations; size_t _allocated_size; @@ -101,15 +100,6 @@ void print_stats(const char* tag); Thread* thread(); - - // statistics - - int number_of_refills() const { return _number_of_refills; } - int fast_refill_waste() const { return _fast_refill_waste; } - int slow_refill_waste() const { return _slow_refill_waste; } - int gc_waste() const { return _gc_waste; } - int slow_allocations() const { return _slow_allocations; } - public: ThreadLocalAllocBuffer() : _allocated_before_last_gc(0), _allocation_fraction(TLABAllocationWeight) { // do nothing. tlabs must be inited by initialize() calls @@ -198,10 +188,8 @@ static PerfVariable* _perf_total_allocations; static PerfVariable* _perf_total_gc_waste; static PerfVariable* _perf_max_gc_waste; - static PerfVariable* _perf_total_slow_refill_waste; - static PerfVariable* _perf_max_slow_refill_waste; - static PerfVariable* _perf_total_fast_refill_waste; - static PerfVariable* _perf_max_fast_refill_waste; + static PerfVariable* _perf_total_refill_waste; + static PerfVariable* _perf_max_refill_waste; static PerfVariable* _perf_total_slow_allocations; static PerfVariable* _perf_max_slow_allocations; @@ -213,10 +201,8 @@ size_t _total_allocations; size_t _total_gc_waste; size_t _max_gc_waste; - size_t _total_fast_refill_waste; - size_t _max_fast_refill_waste; - size_t _total_slow_refill_waste; - size_t _max_slow_refill_waste; + size_t _total_refill_waste; + size_t _max_refill_waste; unsigned int _total_slow_allocations; unsigned int _max_slow_allocations; @@ -229,8 +215,7 @@ void update_fast_allocations(unsigned int refills, size_t allocations, size_t gc_waste, - size_t fast_refill_waste, - size_t slow_refill_waste); + size_t refill_waste); void update_slow_allocations(unsigned int allocations); void update(const ThreadLocalAllocStats& other); diff --git a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp --- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp +++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp @@ -337,7 +337,6 @@ nonstatic_field(ThreadLocalAllocBuffer, _desired_size, size_t) \ nonstatic_field(ThreadLocalAllocBuffer, _refill_waste_limit, size_t) \ nonstatic_field(ThreadLocalAllocBuffer, _number_of_refills, unsigned) \ - nonstatic_field(ThreadLocalAllocBuffer, _fast_refill_waste, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _slow_allocations, unsigned) \ \ nonstatic_field(ThreadShadow, _pending_exception, oop) \ diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -415,8 +415,7 @@ static_field(ThreadLocalAllocBuffer, _reserve_for_allocation_prefetch, int) \ static_field(ThreadLocalAllocBuffer, _target_refills, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _number_of_refills, unsigned) \ - nonstatic_field(ThreadLocalAllocBuffer, _fast_refill_waste, unsigned) \ - nonstatic_field(ThreadLocalAllocBuffer, _slow_refill_waste, unsigned) \ + nonstatic_field(ThreadLocalAllocBuffer, _refill_waste, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _gc_waste, unsigned) \ nonstatic_field(ThreadLocalAllocBuffer, _slow_allocations, unsigned) \ nonstatic_field(VirtualSpace, _low_boundary, char*) \ diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap --- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap +++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/perfdata/resources/aliasmap @@ -1,6 +1,6 @@ /* * -* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2004, 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 @@ -545,6 +545,14 @@ hotspot.gc.tlab.slowalloc // 1.5.0 b21 alias sun.gc.tlab.slowWaste // 1.5.0 b39 hotspot.gc.tlab.slowwaste // 1.5.0 b21 +alias sun.gc.tlab.maxRefillWaste // 13 + hotspot.gc.tlab.maxslowwaste // 1.5.0 b21 +alias sun.gc.tlab.MaxRefillWaste // 13 + sun.gc.tlab.maxSlowWaste // 1.5.0 b39 +alias sun.gc.tlab.refillWaste // 13 + hotspot.gc.tlab.slowwaste // 1.5.0 b21 +alias sun.gc.tlab.refillWaste // 13 + sun.gc.tlab.SlowWaste // 1.5.0 b39 // sun.os alias sun.os.hrt.frequency // 1.5.0 b39 diff --git a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java --- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java +++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java @@ -533,7 +533,6 @@ private final int threadLocalAllocBufferTopOffset = getFieldOffset("ThreadLocalAllocBuffer::_top", Integer.class, "HeapWord*"); private final int threadLocalAllocBufferPfTopOffset = getFieldOffset("ThreadLocalAllocBuffer::_pf_top", Integer.class, "HeapWord*"); private final int threadLocalAllocBufferSlowAllocationsOffset = getFieldOffset("ThreadLocalAllocBuffer::_slow_allocations", Integer.class, "unsigned"); - private final int threadLocalAllocBufferFastRefillWasteOffset = getFieldOffset("ThreadLocalAllocBuffer::_fast_refill_waste", Integer.class, "unsigned"); private final int threadLocalAllocBufferNumberOfRefillsOffset = getFieldOffset("ThreadLocalAllocBuffer::_number_of_refills", Integer.class, "unsigned"); private final int threadLocalAllocBufferRefillWasteLimitOffset = getFieldOffset("ThreadLocalAllocBuffer::_refill_waste_limit", Integer.class, "size_t"); private final int threadLocalAllocBufferDesiredSizeOffset = getFieldOffset("ThreadLocalAllocBuffer::_desired_size", Integer.class, "size_t"); @@ -542,10 +541,6 @@ return threadTlabOffset + threadLocalAllocBufferSlowAllocationsOffset; } - public int tlabFastRefillWasteOffset() { - return threadTlabOffset + threadLocalAllocBufferFastRefillWasteOffset; - } - public int tlabNumberOfRefillsOffset() { return threadTlabOffset + threadLocalAllocBufferNumberOfRefillsOffset; }