Summary
Make MetaspaceReclaimPolicy a diagnostic switch
Problem
JEP-387 revamped Metaspace and, among other things, introduced the product switch MetaspaceReclaimPolicy
. The switch switches between three different behavioral modes:
1) MetaspaceReclaimPolicy=balanced (default) attempts to reclaim Metaspace upon class loader death
2) MetaspaceReclaimPolicy=aggressive does the same but more enthusiastically;
The difference between them is minor; Metaspace has an inbuilt granularity with which memory is committed and uncommitted - 64K by default, 16K in aggressive mode. In practice, it did not matter much: aggressive mode would lead to slightly more reclaimed memory at the cost of slightly more VMA fragmentation.
3) MetaspaceReclaimPolicy=none forfeits memory reclamation altogether. This is a larger break from the other two modes and leads to a bunch of special-path coding in metaspace.
These three modes lead to different code paths that all need to get tested separately to prevent regressions. MetaspaceReclaimPolicy=none, in particular, also makes the code more complex.
The original purpose of this switch, especially the "none" mode, was to have a fallback in case of errors. But post-JEP-387-Metaspace has been very stable and robust; there was never a need for this fallback.
Solution
I would like to make MetaspaceReclaimPolicy
a diagnostic switch, with the expressed freedom to decrease later the number of permutations and/or to completely remove the switch as a user-facing control, without further CSRs.
Specification
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -1423,7 +1423,7 @@ const int ObjectAlignmentInBytes = 8;
"Force the class space to be allocated at this address or " \
"fails VM initialization (requires -Xshare=off.") \
\
- product(ccstr, MetaspaceReclaimPolicy, "balanced", \
+ product(ccstr, MetaspaceReclaimPolicy, "balanced", DIAGNOSTIC, \
"options: balanced, aggressive, none") \
\
product(bool, PrintMetaspaceStatisticsAtExit, false, DIAGNOSTIC, \
- csr of
-
JDK-8302129 Make MetaspaceReclaimPolicy a diagnostic switch
- Resolved
- relates to
-
JDK-8302385 Remove MetaspaceReclaimPolicy=none
- Resolved