Skip to content

Commit a750ac5

Browse files
committedJun 11, 2020
8247358: Shenandoah: reconsider free budget slice for marking
Reviewed-by: zgu
1 parent 56048d0 commit a750ac5

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed
 

‎src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp

+4-8
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,8 @@
5050
* notion of progress is clear: we get reported the "used" size from the processed regions
5151
* and use the global heap-used as the baseline.
5252
*
53-
* The allocatable space when GC is running is "free" at the start of cycle, but the
53+
* The allocatable space when GC is running is "free" at the start of phase, but the
5454
* accounted budget is based on "used". So, we need to adjust the tax knowing that.
55-
* Also, since we effectively count the used space three times (mark, evac, update-refs),
56-
* we need to multiply the tax by 3. Example: for 10 MB free and 90 MB used, GC would
57-
* come back with 3*90 MB budget, and thus for each 1 MB of allocation, we have to pay
58-
* 3*90 / 10 MBs. In the end, we would pay back the entire budget.
5955
*/
6056

6157
void ShenandoahPacer::setup_for_mark() {
@@ -68,7 +64,7 @@ void ShenandoahPacer::setup_for_mark() {
6864
size_t taxable = free - non_taxable;
6965

7066
double tax = 1.0 * live / taxable; // base tax for available free space
71-
tax *= 3; // mark is phase 1 of 3, claim 1/3 of free for it
67+
tax *= 1; // mark can succeed with immediate garbage, claim all available space
7268
tax *= ShenandoahPacingSurcharge; // additional surcharge to help unclutter heap
7369

7470
restart_with(non_taxable, tax);
@@ -91,7 +87,7 @@ void ShenandoahPacer::setup_for_evac() {
9187
size_t taxable = free - non_taxable;
9288

9389
double tax = 1.0 * used / taxable; // base tax for available free space
94-
tax *= 2; // evac is phase 2 of 3, claim 1/2 of remaining free
90+
tax *= 2; // evac is followed by update-refs, claim 1/2 of remaining free
9591
tax = MAX2<double>(1, tax); // never allocate more than GC processes during the phase
9692
tax *= ShenandoahPacingSurcharge; // additional surcharge to help unclutter heap
9793

@@ -115,7 +111,7 @@ void ShenandoahPacer::setup_for_updaterefs() {
115111
size_t taxable = free - non_taxable;
116112

117113
double tax = 1.0 * used / taxable; // base tax for available free space
118-
tax *= 1; // update-refs is phase 3 of 3, claim the remaining free
114+
tax *= 1; // update-refs is the last phase, claim the remaining free
119115
tax = MAX2<double>(1, tax); // never allocate more than GC processes during the phase
120116
tax *= ShenandoahPacingSurcharge; // additional surcharge to help unclutter heap
121117

0 commit comments

Comments
 (0)
Please sign in to comment.