Skip to content

Commit

Permalink
8331392: G1: Make HRPrinter distinguish between different types of re…
Browse files Browse the repository at this point in the history
…clamation

Reviewed-by: ayang, iwalulya, gli
  • Loading branch information
Thomas Schatzl committed May 2, 2024
1 parent 33243d4 commit fe23068
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ class G1UpdateRegionLivenessAndSelectForRebuildTask : public WorkerTask {
if (!_cleanup_list.is_empty()) {
log_debug(gc)("Reclaimed %u empty regions", _cleanup_list.length());
// Now print the empty regions list.
_g1h->hr_printer()->cleanup(&_cleanup_list);
_g1h->hr_printer()->mark_reclaim(&_cleanup_list);
// And actually make them available.
_g1h->prepend_to_freelist(&_cleanup_list);
}
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1HRPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
#include "gc/g1/g1HeapRegionSet.hpp"
#include "gc/g1/g1HRPrinter.hpp"

void G1HRPrinter::cleanup(FreeRegionList* cleanup_list) {
void G1HRPrinter::mark_reclaim(FreeRegionList* cleanup_list) {
if (is_active()) {
FreeRegionListIterator iter(cleanup_list);
while (iter.more_available()) {
HeapRegion* hr = iter.get_next();
cleanup(hr);
mark_reclaim(hr);
}
}
}
16 changes: 13 additions & 3 deletions src/hotspot/share/gc/g1/g1HRPrinter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class G1HRPrinter {
action, hr->get_type_str(), p2i(hr->bottom()), p2i(hr->top()), p2i(hr->end()));
}

void mark_reclaim(HeapRegion* hr) {
print("MARK-RECLAIM", hr);
}

public:
// In some places we iterate over a list in order to generate output
// for the list's elements. By exposing this we can avoid this
Expand Down Expand Up @@ -78,13 +82,19 @@ class G1HRPrinter {
}
}

void cleanup(HeapRegion* hr) {
void mark_reclaim(FreeRegionList* free_list);

void eager_reclaim(HeapRegion* hr) {
if (is_active()) {
print("CLEANUP", hr);
print("EAGER-RECLAIM", hr);
}
}

void cleanup(FreeRegionList* free_list);
void evac_reclaim(HeapRegion* hr) {
if (is_active()) {
print("EVAC-RECLAIM", hr);
}
}

void post_compaction(HeapRegion* hr) {
if (is_active()) {
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class G1FreeHumongousRegionClosure : public HeapRegionIndexClosure {
r->set_containing_set(nullptr);
_humongous_regions_reclaimed++;
_g1h->free_humongous_region(r, nullptr);
_g1h->hr_printer()->cleanup(r);
_g1h->hr_printer()->eager_reclaim(r);
};

_g1h->humongous_obj_regions_iterate(r, free_humongous_region);
Expand Down Expand Up @@ -760,7 +760,7 @@ class FreeCSetClosure : public HeapRegionClosure {

// Free the region and its remembered set.
_g1h->free_region(r, nullptr);
_g1h->hr_printer()->cleanup(r);
_g1h->hr_printer()->evac_reclaim(r);
}

void handle_failed_region(HeapRegion* r) {
Expand Down

1 comment on commit fe23068

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.