8291418: adjust monitor deflation logging and deflate_idle_monitors use
Reviewed-by: dholmes, stuefe, pchilanomate
This commit is contained in:
parent
6e5470525d
commit
6065516bb3
@ -1497,6 +1497,8 @@ size_t ObjectSynchronizer::deflate_idle_monitors(ObjectMonitorsHashtable* table)
|
|||||||
|
|
||||||
// Deflate some idle ObjectMonitors.
|
// Deflate some idle ObjectMonitors.
|
||||||
size_t deflated_count = deflate_monitor_list(current, ls, &timer, table);
|
size_t deflated_count = deflate_monitor_list(current, ls, &timer, table);
|
||||||
|
size_t unlinked_count = 0;
|
||||||
|
size_t deleted_count = 0;
|
||||||
if (deflated_count > 0 || is_final_audit()) {
|
if (deflated_count > 0 || is_final_audit()) {
|
||||||
// There are ObjectMonitors that have been deflated or this is the
|
// There are ObjectMonitors that have been deflated or this is the
|
||||||
// final audit and all the remaining ObjectMonitors have been
|
// final audit and all the remaining ObjectMonitors have been
|
||||||
@ -1506,8 +1508,7 @@ size_t ObjectSynchronizer::deflate_idle_monitors(ObjectMonitorsHashtable* table)
|
|||||||
// Unlink deflated ObjectMonitors from the in-use list.
|
// Unlink deflated ObjectMonitors from the in-use list.
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
GrowableArray<ObjectMonitor*> delete_list((int)deflated_count);
|
GrowableArray<ObjectMonitor*> delete_list((int)deflated_count);
|
||||||
size_t unlinked_count = _in_use_list.unlink_deflated(current, ls, &timer,
|
unlinked_count = _in_use_list.unlink_deflated(current, ls, &timer, &delete_list);
|
||||||
&delete_list);
|
|
||||||
if (current->is_Java_thread()) {
|
if (current->is_Java_thread()) {
|
||||||
if (ls != NULL) {
|
if (ls != NULL) {
|
||||||
timer.stop();
|
timer.stop();
|
||||||
@ -1533,7 +1534,6 @@ size_t ObjectSynchronizer::deflate_idle_monitors(ObjectMonitorsHashtable* table)
|
|||||||
|
|
||||||
// After the handshake, safely free the ObjectMonitors that were
|
// After the handshake, safely free the ObjectMonitors that were
|
||||||
// deflated in this cycle.
|
// deflated in this cycle.
|
||||||
size_t deleted_count = 0;
|
|
||||||
for (ObjectMonitor* monitor: delete_list) {
|
for (ObjectMonitor* monitor: delete_list) {
|
||||||
delete monitor;
|
delete monitor;
|
||||||
deleted_count++;
|
deleted_count++;
|
||||||
@ -1544,13 +1544,14 @@ size_t ObjectSynchronizer::deflate_idle_monitors(ObjectMonitorsHashtable* table)
|
|||||||
deleted_count, ls, &timer);
|
deleted_count, ls, &timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert(unlinked_count == deleted_count, "must be");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ls != NULL) {
|
if (ls != NULL) {
|
||||||
timer.stop();
|
timer.stop();
|
||||||
if (deflated_count != 0 || log_is_enabled(Debug, monitorinflation)) {
|
if (deflated_count != 0 || unlinked_count != 0 || log_is_enabled(Debug, monitorinflation)) {
|
||||||
ls->print_cr("deflated " SIZE_FORMAT " monitors in %3.7f secs",
|
ls->print_cr("deflated_count=" SIZE_FORMAT ", {unlinked,deleted}_count=" SIZE_FORMAT " monitors in %3.7f secs",
|
||||||
deflated_count, timer.seconds());
|
deflated_count, unlinked_count, timer.seconds());
|
||||||
}
|
}
|
||||||
ls->print_cr("end deflating: in_use_list stats: ceiling=" SIZE_FORMAT ", count=" SIZE_FORMAT ", max=" SIZE_FORMAT,
|
ls->print_cr("end deflating: in_use_list stats: ceiling=" SIZE_FORMAT ", count=" SIZE_FORMAT ", max=" SIZE_FORMAT,
|
||||||
in_use_list_ceiling(), _in_use_list.count(), _in_use_list.max());
|
in_use_list_ceiling(), _in_use_list.count(), _in_use_list.max());
|
||||||
@ -1659,17 +1660,18 @@ void ObjectSynchronizer::do_final_audit_and_print_stats() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
set_is_final_audit();
|
set_is_final_audit();
|
||||||
|
log_info(monitorinflation)("Starting the final audit.");
|
||||||
|
|
||||||
if (log_is_enabled(Info, monitorinflation)) {
|
if (log_is_enabled(Info, monitorinflation)) {
|
||||||
// Do a deflation in order to reduce the in-use monitor population
|
// Do deflations in order to reduce the in-use monitor population
|
||||||
// that is reported by ObjectSynchronizer::log_in_use_monitor_details()
|
// that is reported by ObjectSynchronizer::log_in_use_monitor_details()
|
||||||
// which is called by ObjectSynchronizer::audit_and_print_stats().
|
// which is called by ObjectSynchronizer::audit_and_print_stats().
|
||||||
while (ObjectSynchronizer::deflate_idle_monitors(/* ObjectMonitorsHashtable is not needed here */ nullptr) >= (size_t)MonitorDeflationMax) {
|
while (deflate_idle_monitors(/* ObjectMonitorsHashtable is not needed here */ nullptr) > 0) {
|
||||||
; // empty
|
; // empty
|
||||||
}
|
}
|
||||||
// The other audit_and_print_stats() call is done at the Debug
|
// The other audit_and_print_stats() call is done at the Debug
|
||||||
// level at a safepoint in SafepointSynchronize::do_cleanup_tasks.
|
// level at a safepoint in SafepointSynchronize::do_cleanup_tasks.
|
||||||
ObjectSynchronizer::audit_and_print_stats(true /* on_exit */);
|
audit_and_print_stats(true /* on_exit */);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ void VM_ThreadDump::doit() {
|
|||||||
// when there are a lot of inflated monitors. So we deflate idle monitors and
|
// when there are a lot of inflated monitors. So we deflate idle monitors and
|
||||||
// gather information about owned monitors at the same time.
|
// gather information about owned monitors at the same time.
|
||||||
tablep = &table;
|
tablep = &table;
|
||||||
while (ObjectSynchronizer::deflate_idle_monitors(tablep) >= (size_t)MonitorDeflationMax) {
|
while (ObjectSynchronizer::deflate_idle_monitors(tablep) > 0) {
|
||||||
; /* empty */
|
; /* empty */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user