Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8319896: Remove monitor deflation from final audit #16605

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/hotspot/share/runtime/synchronizer.cpp
Original file line number Diff line number Diff line change
@@ -1592,7 +1592,7 @@ static size_t delete_monitors(GrowableArray<ObjectMonitor*>* delete_list) {
}

// This function is called by the MonitorDeflationThread to deflate
// ObjectMonitors. It is also called via do_final_audit_and_print_stats().
// ObjectMonitors.
size_t ObjectSynchronizer::deflate_idle_monitors() {
Thread* current = Thread::current();
if (current->is_Java_thread()) {
@@ -1622,10 +1622,7 @@ size_t ObjectSynchronizer::deflate_idle_monitors() {
size_t unlinked_count = 0;
size_t deleted_count = 0;
if (deflated_count > 0) {
Copy link
Contributor

@coleenp coleenp Nov 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a conditional at line 1631 is_monitor_deflation_thread, and an else at 1657 that deflating idle monitors is at a safepoint. Should there not be this conditional, ie am I reading the description right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. The plan in my head has been to remove the safepointed monitor deflation first and then take a pass over the code and remove the various blocks that we don't execute anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@coleenp I created a PR to clean this up:
#16706

// There are ObjectMonitors that have been deflated or this is the
// final audit and all the remaining ObjectMonitors have been
// deflated, BUT the MonitorDeflationThread blocked for the final
// safepoint during unlinking.
// There are ObjectMonitors that have been deflated.

// Unlink deflated ObjectMonitors from the in-use list.
ResourceMark rm;
2 changes: 1 addition & 1 deletion src/hotspot/share/runtime/vmOperations.cpp
Original file line number Diff line number Diff line change
@@ -344,7 +344,7 @@ class ObjectMonitorsDump : public MonitorClosure, public ObjectMonitorsView {

if (monitor->is_owner_anonymous()) {
// There's no need to collect anonymous owned monitors
// because the callers of this code is only interested
// because the caller of this code is only interested
// in JNI owned monitors.
return;
}