Request for review: 6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency

Tao Mao tao.mao at
Sun Jun 23 03:03:15 UTC 2013

6521376: MaxTenuringThreshold and AlwayTenure/NeverTenure consistency


changeset: For all collectors,

(1) Setting -XX:+NeverTenure/-XX:+AlwaysTenure
NeverTenure=true; AlwaysTenure=false;  
MaxTenuringThreshold=markOopDesc::max_age+1 (i.e. 16, use the value 
instead below);

NeverTenure=false; AlwaysTenure=true;  MaxTenuringThreshold=0;

(2) Setting MaxTenuringThreshold

(2-a) MaxTenuringThreshold == 0
if (MaxTenuringThreshold == 0):
"the cap equals 0" implies AlwaysTenure=true, so set flags accordingly 
(NeverTenure=false; AlwaysTenure=true).

(2-b) MaxTenuringThreshold > 0
But, considering the ergonomics for tenuring threshold (see 
CMSAdaptiveSizePolicy::compute_survivor_space_size_and_threshold() and 
ageTable::compute_tenuring_threshold()), we will adjust tenure_threshold 
up and down but below the cap MaxTenuringThreshold during the 
application run.

Thus, setting MaxTenuringThreshold >= 16 would not necessarily imply 
that the user wants to apply NeverTenure to the VM for the real 
tenure_threshold may need to go below MaxTenuringThreshold as the 
process stats suggest.

With that said,
if (MaxTenuringThreshold > 0):
I simply set NeverTenure/AlwaysTenure to false. (neither NeverTenure nor 
and if (MaxTenuringThreshold > 16): set MaxTenuringThreshold to 16 as it 
is unnecessary to be larger.

*(3) -XX:-NeverTenure/-XX:-AlwaysTenure only need to take care of 
themselves and don't need the flag consistency maintenance here.

Take a little convoluted case for example: suppose that we have the 
following gc options "-XX:+NeverTenure -XX:+MaxTenuringThreshold=18" in 
this particular order.

When we first parse "-XX:+NeverTenure", we would set: NeverTenure=true; 
AlwaysTenure=false;  MaxTenuringThreshold=16.

But when we encounter the second option "-XX:+MaxTenuringThreshold=18", 
we would think the user knows about gc ergonomics for tenuring threshold 
and wants MaxTenuringThreshold to just be a cap for the ergonomics 
rather than wants to (implicitly) use NeverTenure. So, we would set 
NeverTenure=false; AlwaysTenure=false; and finally 
MaxTenuringThreshold=16 to reflect the cap maximum.

More information about the hotspot-gc-dev mailing list