Skip to content

Commit

Permalink
store the "default size" for the PLAB in the PLABStats
Browse files Browse the repository at this point in the history
  • Loading branch information
dongbohe committed Nov 29, 2020
1 parent 1f975aa commit 04102cb
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Expand Up @@ -1406,8 +1406,8 @@ G1CollectedHeap::G1CollectedHeap() :
_summary_bytes_used(0),
_bytes_used_during_gc(0),
_archive_allocator(NULL),
_survivor_evac_stats("Young", YoungPLABSize * ParallelGCThreads, PLABWeight),
_old_evac_stats("Old", OldPLABSize * ParallelGCThreads, PLABWeight),
_survivor_evac_stats("Young", YoungPLABSize, YoungPLABSize * ParallelGCThreads, PLABWeight),
_old_evac_stats("Old", OldPLABSize, OldPLABSize * ParallelGCThreads, PLABWeight),
_expand_heap_after_alloc_failure(true),
_g1mm(NULL),
_humongous_reclaim_candidates(),
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/g1/g1EvacStats.cpp
Expand Up @@ -88,8 +88,8 @@ size_t G1EvacStats::compute_desired_plab_sz() {
return cur_plab_sz;
}

G1EvacStats::G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt) :
PLABStats(description, desired_plab_sz_, wt),
G1EvacStats::G1EvacStats(const char* description, size_t default_plab_sz, size_t desired_plab_sz_, unsigned wt) :
PLABStats(description, default_plab_sz, desired_plab_sz_, wt), // desired_plab_size should be the total PLAB size for all threads.
_region_end_waste(0),
_regions_filled(0),
_direct_allocated(0),
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/g1/g1EvacStats.hpp
Expand Up @@ -56,7 +56,7 @@ class G1EvacStats : public PLABStats {
virtual size_t compute_desired_plab_sz();

public:
G1EvacStats(const char* description, size_t desired_plab_sz_, unsigned wt);
G1EvacStats(const char* description, size_t default_plab_sz, size_t desired_plab_sz_, unsigned wt);

~G1EvacStats();

Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/gc/shared/plab.cpp
Expand Up @@ -135,6 +135,9 @@ void PLABStats::log_sizing(size_t calculated_words, size_t net_desired_words) {

// Calculates plab size for current number of gc worker threads.
size_t PLABStats::desired_plab_sz(uint no_of_gc_workers) {
if (!ResizePLAB) {
return _default_plab_sz;
}
return align_object_size(clamp(_desired_net_plab_sz / no_of_gc_workers, min_size(), max_size()));
}

Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/gc/shared/plab.hpp
Expand Up @@ -151,6 +151,7 @@ class PLABStats : public CHeapObj<mtGC> {
size_t _wasted; // of which wasted (internal fragmentation)
size_t _undo_wasted; // of which wasted on undo (is not used for calculation of PLAB size)
size_t _unused; // Unused in last buffer
size_t _default_plab_sz;
size_t _desired_net_plab_sz;// Output of filter (below), suitably trimmed and quantized
AdaptiveWeightedAverage
_filter; // Integrator with decay
Expand All @@ -169,12 +170,13 @@ class PLABStats : public CHeapObj<mtGC> {
virtual size_t compute_desired_plab_sz();

public:
PLABStats(const char* description, size_t desired_net_plab_sz_, unsigned wt) :
PLABStats(const char* description, size_t default_plab_sz, size_t desired_net_plab_sz_, unsigned wt) :
_description(description),
_allocated(0),
_wasted(0),
_undo_wasted(0),
_unused(0),
_default_plab_sz(default_plab_sz),
_desired_net_plab_sz(desired_net_plab_sz_),
_filter(wt)
{ }
Expand Down

0 comments on commit 04102cb

Please sign in to comment.