8245720: Shenandoah: improve configuration logging

Reviewed-by: rkennke
This commit is contained in:
Aleksey Shipilev 2020-05-26 13:06:42 +02:00
parent 035d5dffb1
commit c31cae7b53
5 changed files with 118 additions and 28 deletions

@ -46,6 +46,7 @@
#include "gc/shenandoah/shenandoahHeap.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.inline.hpp"
#include "gc/shenandoah/shenandoahHeapRegionSet.hpp"
#include "gc/shenandoah/shenandoahInitLogger.hpp"
#include "gc/shenandoah/shenandoahMarkCompact.hpp"
#include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
#include "gc/shenandoah/shenandoahMemoryPool.hpp"
@ -404,13 +405,10 @@ jint ShenandoahHeap::initialize() {
_control_thread = new ShenandoahControlThread();
log_info(gc, init)("Initialize Shenandoah heap: " SIZE_FORMAT "%s initial, " SIZE_FORMAT "%s min, " SIZE_FORMAT "%s max",
byte_size_in_proper_unit(_initial_size), proper_unit_for_byte_size(_initial_size),
byte_size_in_proper_unit(_minimum_size), proper_unit_for_byte_size(_minimum_size),
byte_size_in_proper_unit(max_capacity()), proper_unit_for_byte_size(max_capacity())
);
_ref_proc_mt_processing = ParallelRefProcEnabled && (ParallelGCThreads > 1);
_ref_proc_mt_discovery = _max_workers > 1;
log_info(gc, init)("Safepointing mechanism: thread-local poll");
ShenandoahInitLogger::print();
return JNI_OK;
}
@ -440,8 +438,6 @@ void ShenandoahHeap::initialize_heuristics() {
err_msg("GC mode \"%s\" is experimental, and must be enabled via -XX:+UnlockExperimentalVMOptions.",
_gc_mode->name()));
}
log_info(gc, init)("Shenandoah GC mode: %s",
_gc_mode->name());
_heuristics = _gc_mode->initialize_heuristics();
@ -455,8 +451,6 @@ void ShenandoahHeap::initialize_heuristics() {
err_msg("Heuristics \"%s\" is experimental, and must be enabled via -XX:+UnlockExperimentalVMOptions.",
_heuristics->name()));
}
log_info(gc, init)("Shenandoah heuristics: %s",
_heuristics->name());
}
#ifdef _MSC_VER
@ -505,8 +499,6 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) :
{
_heap = this;
log_info(gc, init)("GC threads: " UINT32_FORMAT " parallel, " UINT32_FORMAT " concurrent", ParallelGCThreads, ConcGCThreads);
BarrierSet::set_barrier_set(new ShenandoahBarrierSet(this));
_max_workers = MAX2(_max_workers, 1U);
@ -2152,23 +2144,16 @@ void ShenandoahHeap::set_concurrent_weak_root_in_progress(bool in_progress) {
void ShenandoahHeap::ref_processing_init() {
assert(_max_workers > 0, "Sanity");
bool mt_processing = ParallelRefProcEnabled && (ParallelGCThreads > 1);
bool mt_discovery = _max_workers > 1;
_ref_processor =
new ReferenceProcessor(&_subject_to_discovery, // is_subject_to_discovery
mt_processing, // MT processing
_ref_proc_mt_processing, // MT processing
_max_workers, // Degree of MT processing
mt_discovery, // MT discovery
_ref_proc_mt_discovery, // MT discovery
_max_workers, // Degree of MT discovery
false, // Reference discovery is not atomic
NULL, // No closure, should be installed before use
true); // Scale worker threads
log_info(gc, init)("Reference processing: %s discovery, %s processing",
mt_discovery ? "parallel" : "serial",
mt_processing ? "parallel" : "serial");
shenandoah_assert_rp_isalive_not_installed();
}

@ -457,6 +457,7 @@ private:
public:
ShenandoahCollectorPolicy* shenandoah_policy() const { return _shenandoah_policy; }
ShenandoahMode* mode() const { return _gc_mode; }
ShenandoahHeuristics* heuristics() const { return _heuristics; }
ShenandoahFreeSet* free_set() const { return _free_set; }
ShenandoahConcurrentMark* concurrent_mark() { return _scm; }
@ -496,11 +497,15 @@ private:
AlwaysTrueClosure _subject_to_discovery;
ReferenceProcessor* _ref_processor;
ShenandoahSharedFlag _process_references;
bool _ref_proc_mt_discovery;
bool _ref_proc_mt_processing;
void ref_processing_init();
public:
ReferenceProcessor* ref_processor() { return _ref_processor; }
bool ref_processor_mt_discovery() { return _ref_proc_mt_discovery; }
bool ref_processor_mt_processing() { return _ref_proc_mt_processing; }
void set_process_references(bool pr);
bool process_references() const;

@ -609,13 +609,6 @@ void ShenandoahHeapRegion::setup_sizes(size_t max_heap_size) {
guarantee(MaxTLABSizeBytes == 0, "we should only set it once");
MaxTLABSizeBytes = MaxTLABSizeWords * HeapWordSize;
assert (MaxTLABSizeBytes > MinTLABSize, "should be larger");
log_info(gc, init)("Regions: " SIZE_FORMAT " x " SIZE_FORMAT "%s",
RegionCount, byte_size_in_proper_unit(RegionSizeBytes), proper_unit_for_byte_size(RegionSizeBytes));
log_info(gc, init)("Humongous object threshold: " SIZE_FORMAT "%s",
byte_size_in_proper_unit(HumongousThresholdBytes), proper_unit_for_byte_size(HumongousThresholdBytes));
log_info(gc, init)("Max TLAB size: " SIZE_FORMAT "%s",
byte_size_in_proper_unit(MaxTLABSizeBytes), proper_unit_for_byte_size(MaxTLABSizeBytes));
}
void ShenandoahHeapRegion::do_commit() {

@ -0,0 +1,69 @@
/*
* Copyright (c) 2020, Red Hat, Inc. 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc/shenandoah/shenandoahHeap.hpp"
#include "gc/shenandoah/shenandoahHeapRegion.hpp"
#include "gc/shenandoah/shenandoahInitLogger.hpp"
#include "gc/shenandoah/heuristics/shenandoahHeuristics.hpp"
#include "gc/shenandoah/mode/shenandoahMode.hpp"
#include "logging/log.hpp"
#include "runtime/globals.hpp"
#include "utilities/globalDefinitions.hpp"
void ShenandoahInitLogger::print_heap() {
GCInitLogger::print_heap();
ShenandoahHeap* heap = ShenandoahHeap::heap();
log_info(gc, init)("Mode: %s",
heap->mode()->name());
log_info(gc, init)("Heuristics: %s",
heap->heuristics()->name());
log_info(gc, init)("Heap Region Count: " SIZE_FORMAT,
ShenandoahHeapRegion::region_count());
log_info(gc, init)("Heap Region Size: " SIZE_FORMAT "%s",
byte_size_in_exact_unit(ShenandoahHeapRegion::region_size_bytes()),
exact_unit_for_byte_size(ShenandoahHeapRegion::region_size_bytes()));
log_info(gc, init)("TLAB Size Max: " SIZE_FORMAT "%s",
byte_size_in_exact_unit(ShenandoahHeapRegion::max_tlab_size_bytes()),
exact_unit_for_byte_size(ShenandoahHeapRegion::max_tlab_size_bytes()));
log_info(gc, init)("Humongous Object Threshold: " SIZE_FORMAT "%s",
byte_size_in_exact_unit(ShenandoahHeapRegion::humongous_threshold_bytes()),
exact_unit_for_byte_size(ShenandoahHeapRegion::humongous_threshold_bytes()));
log_info(gc, init)("Reference Processing: %s discovery, %s processing",
heap->ref_processor_mt_discovery() ? "Parallel" : "Serial",
heap->ref_processor_mt_processing() ? "Parallel" : "Serial");
}
void ShenandoahInitLogger::print() {
ShenandoahInitLogger init_log;
init_log.print_all();
}

@ -0,0 +1,38 @@
/*
* Copyright (c) 2020, Red Hat, Inc. 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.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHINITLOGGER_HPP
#define SHARE_GC_SHENANDOAH_SHENANDOAHINITLOGGER_HPP
#include "gc/shared/gcInitLogger.hpp"
class ShenandoahInitLogger : public GCInitLogger {
protected:
virtual void print_heap();
public:
static void print();
};
#endif // SHARE_GC_SHENANDOAH_SHENANDOAHINITLOGGER_HPP