mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8371791: G1: Improve accuracy of G1CollectedHeap::non_young_occupancy_after_allocation()
Reviewed-by: ayang, iwalulya
This commit is contained in:
parent
ff851de852
commit
4cc655a2f4
@ -123,6 +123,14 @@ void G1Allocator::reuse_retained_old_region(G1EvacInfo* evacuation_info,
|
||||
}
|
||||
}
|
||||
|
||||
size_t G1Allocator::free_bytes_in_retained_old_region() const {
|
||||
if (_retained_old_gc_alloc_region == nullptr) {
|
||||
return 0;
|
||||
} else {
|
||||
return _retained_old_gc_alloc_region->free();
|
||||
}
|
||||
}
|
||||
|
||||
void G1Allocator::init_gc_alloc_regions(G1EvacInfo* evacuation_info) {
|
||||
assert_at_safepoint_on_vm_thread();
|
||||
|
||||
|
||||
@ -103,7 +103,10 @@ public:
|
||||
void init_gc_alloc_regions(G1EvacInfo* evacuation_info);
|
||||
void release_gc_alloc_regions(G1EvacInfo* evacuation_info);
|
||||
void abandon_gc_alloc_regions();
|
||||
|
||||
bool is_retained_old_region(G1HeapRegion* hr);
|
||||
// Return the amount of free bytes in the current retained old region.
|
||||
size_t free_bytes_in_retained_old_region() const;
|
||||
|
||||
// Node index of current thread.
|
||||
inline uint current_node_index() const;
|
||||
|
||||
@ -2964,8 +2964,8 @@ void G1CollectedHeap::abandon_collection_set() {
|
||||
}
|
||||
|
||||
size_t G1CollectedHeap::non_young_occupancy_after_allocation(size_t allocation_word_size) {
|
||||
// For simplicity, just count whole regions.
|
||||
const size_t cur_occupancy = (old_regions_count() + humongous_regions_count()) * G1HeapRegion::GrainBytes;
|
||||
const size_t cur_occupancy = (old_regions_count() + humongous_regions_count()) * G1HeapRegion::GrainBytes -
|
||||
_allocator->free_bytes_in_retained_old_region();
|
||||
// Humongous allocations will always be assigned to non-young heap, so consider
|
||||
// that allocation in the result as well. Otherwise the allocation will always
|
||||
// be in young gen, so there is no need to account it here.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user