1 /*
   2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_GC_CMS_CMS_GLOBALS_HPP
  26 #define SHARE_GC_CMS_CMS_GLOBALS_HPP
  27 
  28 #define GC_CMS_FLAGS(develop,                                               \
  29                      develop_pd,                                            \
  30                      product,                                               \
  31                      product_pd,                                            \
  32                      diagnostic,                                            \
  33                      diagnostic_pd,                                         \
  34                      experimental,                                          \
  35                      notproduct,                                            \
  36                      manageable,                                            \
  37                      product_rw,                                            \
  38                      lp64_product,                                          \
  39                      range,                                                 \
  40                      constraint,                                            \
  41                      writeable)                                             \
  42   product(bool, UseCMSBestFit, true,                                        \
  43           "Use CMS best fit allocation strategy")                           \
  44                                                                             \
  45   product(size_t, CMSOldPLABMax, 1024,                                      \
  46           "Maximum size of CMS gen promotion LAB caches per worker "        \
  47           "per block size")                                                 \
  48           range(1, max_uintx)                                               \
  49           constraint(CMSOldPLABMaxConstraintFunc,AfterMemoryInit)           \
  50                                                                             \
  51   product(size_t, CMSOldPLABMin, 16,                                        \
  52           "Minimum size of CMS gen promotion LAB caches per worker "        \
  53           "per block size")                                                 \
  54           range(1, max_uintx)                                               \
  55           constraint(CMSOldPLABMinConstraintFunc,AfterMemoryInit)           \
  56                                                                             \
  57   product(uintx, CMSOldPLABNumRefills, 4,                                   \
  58           "Nominal number of refills of CMS gen promotion LAB cache "       \
  59           "per worker per block size")                                      \
  60           range(1, max_uintx)                                               \
  61                                                                             \
  62   product(bool, CMSOldPLABResizeQuicker, false,                             \
  63           "React on-the-fly during a scavenge to a sudden "                 \
  64           "change in block demand rate")                                    \
  65                                                                             \
  66   product(uintx, CMSOldPLABToleranceFactor, 4,                              \
  67           "The tolerance of the phase-change detector for on-the-fly "      \
  68           "PLAB resizing during a scavenge")                                \
  69           range(1, max_uintx)                                               \
  70                                                                             \
  71   product(uintx, CMSOldPLABReactivityFactor, 2,                             \
  72           "The gain in the feedback loop for on-the-fly PLAB resizing "     \
  73           "during a scavenge")                                              \
  74           range(1, max_uintx)                                               \
  75                                                                             \
  76   product_pd(size_t, CMSYoungGenPerWorker,                                  \
  77           "The maximum size of young gen chosen by default per GC worker "  \
  78           "thread available")                                               \
  79           range(1, max_uintx)                                               \
  80                                                                             \
  81   product(uintx, CMSIncrementalSafetyFactor, 10,                            \
  82           "Percentage (0-100) used to add conservatism when computing the " \
  83           "duty cycle")                                                     \
  84           range(0, 100)                                                     \
  85                                                                             \
  86   product(uintx, CMSExpAvgFactor, 50,                                       \
  87           "Percentage (0-100) used to weight the current sample when "      \
  88           "computing exponential averages for CMS statistics")              \
  89           range(0, 100)                                                     \
  90                                                                             \
  91   product(uintx, CMS_FLSWeight, 75,                                         \
  92           "Percentage (0-100) used to weight the current sample when "      \
  93           "computing exponentially decaying averages for CMS FLS "          \
  94           "statistics")                                                     \
  95           range(0, 100)                                                     \
  96                                                                             \
  97   product(uintx, CMS_FLSPadding, 1,                                         \
  98           "The multiple of deviation from mean to use for buffering "       \
  99           "against volatility in free list demand")                         \
 100           range(0, max_juint)                                               \
 101                                                                             \
 102   product(uintx, FLSCoalescePolicy, 2,                                      \
 103           "CMS: aggressiveness level for coalescing, increasing "           \
 104           "from 0 to 4")                                                    \
 105           range(0, 4)                                                       \
 106                                                                             \
 107   product(bool, FLSAlwaysCoalesceLarge, false,                              \
 108           "CMS: larger free blocks are always available for coalescing")    \
 109                                                                             \
 110   product(double, FLSLargestBlockCoalesceProximity, 0.99,                   \
 111           "CMS: the smaller the percentage the greater the coalescing "     \
 112           "force")                                                          \
 113           range(0.0, 1.0)                                                   \
 114                                                                             \
 115   product(double, CMSSmallCoalSurplusPercent, 1.05,                         \
 116           "CMS: the factor by which to inflate estimated demand of small "  \
 117           "block sizes to prevent coalescing with an adjoining block")      \
 118           range(0.0, DBL_MAX)                                               \
 119                                                                             \
 120   product(double, CMSLargeCoalSurplusPercent, 0.95,                         \
 121           "CMS: the factor by which to inflate estimated demand of large "  \
 122           "block sizes to prevent coalescing with an adjoining block")      \
 123           range(0.0, DBL_MAX)                                               \
 124                                                                             \
 125   product(double, CMSSmallSplitSurplusPercent, 1.10,                        \
 126           "CMS: the factor by which to inflate estimated demand of small "  \
 127           "block sizes to prevent splitting to supply demand for smaller "  \
 128           "blocks")                                                         \
 129           range(0.0, DBL_MAX)                                               \
 130                                                                             \
 131   product(double, CMSLargeSplitSurplusPercent, 1.00,                        \
 132           "CMS: the factor by which to inflate estimated demand of large "  \
 133           "block sizes to prevent splitting to supply demand for smaller "  \
 134           "blocks")                                                         \
 135           range(0.0, DBL_MAX)                                               \
 136                                                                             \
 137   product(bool, CMSExtrapolateSweep, false,                                 \
 138           "CMS: cushion for block demand during sweep")                     \
 139                                                                             \
 140   product(uintx, CMS_SweepWeight, 75,                                       \
 141           "Percentage (0-100) used to weight the current sample when "      \
 142           "computing exponentially decaying average for inter-sweep "       \
 143           "duration")                                                       \
 144           range(0, 100)                                                     \
 145                                                                             \
 146   product(uintx, CMS_SweepPadding, 1,                                       \
 147           "The multiple of deviation from mean to use for buffering "       \
 148           "against volatility in inter-sweep duration")                     \
 149           range(0, max_juint)                                               \
 150                                                                             \
 151   product(uintx, CMS_SweepTimerThresholdMillis, 10,                         \
 152           "Skip block flux-rate sampling for an epoch unless inter-sweep "  \
 153           "duration exceeds this threshold in milliseconds")                \
 154           range(0, max_uintx)                                               \
 155                                                                             \
 156   product(bool, CMSClassUnloadingEnabled, true,                             \
 157           "Whether class unloading enabled when using CMS GC")              \
 158                                                                             \
 159   product(uintx, CMSClassUnloadingMaxInterval, 0,                           \
 160           "When CMS class unloading is enabled, the maximum CMS cycle "     \
 161           "count for which classes may not be unloaded")                    \
 162           range(0, max_uintx)                                               \
 163                                                                             \
 164   product(uintx, CMSIndexedFreeListReplenish, 4,                            \
 165           "Replenish an indexed free list with this number of chunks")      \
 166           range(1, max_uintx)                                               \
 167                                                                             \
 168   product(bool, CMSReplenishIntermediate, true,                             \
 169           "Replenish all intermediate free-list caches")                    \
 170                                                                             \
 171   product(bool, CMSSplitIndexedFreeListBlocks, true,                        \
 172           "When satisfying batched demand, split blocks from the "          \
 173           "IndexedFreeList whose size is a multiple of requested size")     \
 174                                                                             \
 175   product(bool, CMSLoopWarn, false,                                         \
 176           "Warn in case of excessive CMS looping")                          \
 177                                                                             \
 178   notproduct(bool, CMSMarkStackOverflowALot, false,                         \
 179           "Simulate frequent marking stack / work queue overflow")          \
 180                                                                             \
 181   notproduct(uintx, CMSMarkStackOverflowInterval, 1000,                     \
 182           "An \"interval\" counter that determines how frequently "         \
 183           "to simulate overflow; a smaller number increases frequency")     \
 184                                                                             \
 185   product(uintx, CMSMaxAbortablePrecleanLoops, 0,                           \
 186           "Maximum number of abortable preclean iterations, if > 0")        \
 187           range(0, max_uintx)                                               \
 188                                                                             \
 189   product(intx, CMSMaxAbortablePrecleanTime, 5000,                          \
 190           "Maximum time in abortable preclean (in milliseconds)")           \
 191           range(0, max_intx)                                                \
 192                                                                             \
 193   product(uintx, CMSAbortablePrecleanMinWorkPerIteration, 100,              \
 194           "Nominal minimum work per abortable preclean iteration")          \
 195           range(0, max_uintx)                                               \
 196                                                                             \
 197   manageable(intx, CMSAbortablePrecleanWaitMillis, 100,                     \
 198           "Time that we sleep between iterations when not given "           \
 199           "enough work per iteration")                                      \
 200           range(0, max_intx)                                                \
 201                                                                             \
 202   /* 4096 = CardTable::card_size_in_words * BitsPerWord */                  \
 203   product(size_t, CMSRescanMultiple, 32,                                    \
 204           "Size (in cards) of CMS parallel rescan task")                    \
 205           range(1, SIZE_MAX / 4096)                                         \
 206           constraint(CMSRescanMultipleConstraintFunc,AfterMemoryInit)       \
 207                                                                             \
 208   /* 4096 = CardTable::card_size_in_words * BitsPerWord */                  \
 209   product(size_t, CMSConcMarkMultiple, 32,                                  \
 210           "Size (in cards) of CMS concurrent MT marking task")              \
 211           range(1, SIZE_MAX / 4096)                                         \
 212           constraint(CMSConcMarkMultipleConstraintFunc,AfterMemoryInit)     \
 213                                                                             \
 214   product(bool, CMSAbortSemantics, false,                                   \
 215           "Whether abort-on-overflow semantics is implemented")             \
 216                                                                             \
 217   product(bool, CMSParallelInitialMarkEnabled, true,                        \
 218           "Use the parallel initial mark.")                                 \
 219                                                                             \
 220   product(bool, CMSParallelRemarkEnabled, true,                             \
 221           "Whether parallel remark enabled (only if ParNewGC)")             \
 222                                                                             \
 223   product(bool, CMSParallelSurvivorRemarkEnabled, true,                     \
 224           "Whether parallel remark of survivor space "                      \
 225           "enabled (effective only if CMSParallelRemarkEnabled)")           \
 226                                                                             \
 227   product(bool, CMSPLABRecordAlways, true,                                  \
 228           "Always record survivor space PLAB boundaries (effective only "   \
 229           "if CMSParallelSurvivorRemarkEnabled)")                           \
 230                                                                             \
 231   product(bool, CMSEdenChunksRecordAlways, true,                            \
 232           "Always record eden chunks used for the parallel initial mark "   \
 233           "or remark of eden")                                              \
 234                                                                             \
 235   product(bool, CMSConcurrentMTEnabled, true,                               \
 236           "Whether multi-threaded concurrent work enabled "                 \
 237           "(effective only if ParNewGC)")                                   \
 238                                                                             \
 239   product(bool, CMSPrecleaningEnabled, true,                                \
 240           "Whether concurrent precleaning enabled")                         \
 241                                                                             \
 242   product(uintx, CMSPrecleanIter, 3,                                        \
 243           "Maximum number of precleaning iteration passes")                 \
 244           range(0, 9)                                                       \
 245                                                                             \
 246   product(uintx, CMSPrecleanDenominator, 3,                                 \
 247           "CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence " \
 248           "ratio")                                                          \
 249           range(1, max_uintx)                                               \
 250           constraint(CMSPrecleanDenominatorConstraintFunc,AfterErgo)        \
 251                                                                             \
 252   product(uintx, CMSPrecleanNumerator, 2,                                   \
 253           "CMSPrecleanNumerator:CMSPrecleanDenominator yields convergence " \
 254           "ratio")                                                          \
 255           range(0, max_uintx-1)                                             \
 256           constraint(CMSPrecleanNumeratorConstraintFunc,AfterErgo)          \
 257                                                                             \
 258   product(bool, CMSPrecleanRefLists1, true,                                 \
 259           "Preclean ref lists during (initial) preclean phase")             \
 260                                                                             \
 261   product(bool, CMSPrecleanRefLists2, false,                                \
 262           "Preclean ref lists during abortable preclean phase")             \
 263                                                                             \
 264   product(bool, CMSPrecleanSurvivors1, false,                               \
 265           "Preclean survivors during (initial) preclean phase")             \
 266                                                                             \
 267   product(bool, CMSPrecleanSurvivors2, true,                                \
 268           "Preclean survivors during abortable preclean phase")             \
 269                                                                             \
 270   product(uintx, CMSPrecleanThreshold, 1000,                                \
 271           "Do not iterate again if number of dirty cards is less than this")\
 272           range(100, max_uintx)                                             \
 273                                                                             \
 274   product(bool, CMSCleanOnEnter, true,                                      \
 275           "Clean-on-enter optimization for reducing number of dirty cards") \
 276                                                                             \
 277   product(uintx, CMSRemarkVerifyVariant, 1,                                 \
 278           "Choose variant (1,2) of verification following remark")          \
 279           range(1, 2)                                                       \
 280                                                                             \
 281   product(size_t, CMSScheduleRemarkEdenSizeThreshold, 2*M,                  \
 282           "If Eden size is below this, do not try to schedule remark")      \
 283           range(0, max_uintx)                                               \
 284                                                                             \
 285   product(uintx, CMSScheduleRemarkEdenPenetration, 50,                      \
 286           "The Eden occupancy percentage (0-100) at which "                 \
 287           "to try and schedule remark pause")                               \
 288           range(0, 100)                                                     \
 289                                                                             \
 290   product(uintx, CMSScheduleRemarkSamplingRatio, 5,                         \
 291           "Start sampling eden top at least before young gen "              \
 292           "occupancy reaches 1/<ratio> of the size at which "               \
 293           "we plan to schedule remark")                                     \
 294           range(1, max_uintx)                                               \
 295                                                                             \
 296   product(uintx, CMSSamplingGrain, 16*K,                                    \
 297           "The minimum distance between eden samples for CMS (see above)")  \
 298           range(ObjectAlignmentInBytes, max_uintx)                          \
 299           constraint(CMSSamplingGrainConstraintFunc,AfterMemoryInit)        \
 300                                                                             \
 301   product(bool, CMSScavengeBeforeRemark, false,                             \
 302           "Attempt scavenge before the CMS remark step")                    \
 303                                                                             \
 304   product(uintx, CMSWorkQueueDrainThreshold, 10,                            \
 305           "Don't drain below this size per parallel worker/thief")          \
 306           range(1, max_juint)                                               \
 307           constraint(CMSWorkQueueDrainThresholdConstraintFunc,AfterErgo)    \
 308                                                                             \
 309   manageable(intx, CMSWaitDuration, 2000,                                   \
 310           "Time in milliseconds that CMS thread waits for young GC")        \
 311           range(min_jint, max_jint)                                         \
 312                                                                             \
 313   develop(uintx, CMSCheckInterval, 1000,                                    \
 314           "Interval in milliseconds that CMS thread checks if it "          \
 315           "should start a collection cycle")                                \
 316                                                                             \
 317   product(bool, CMSYield, true,                                             \
 318           "Yield between steps of CMS")                                     \
 319                                                                             \
 320   product(size_t, CMSBitMapYieldQuantum, 10*M,                              \
 321           "Bitmap operations should process at most this many bits "        \
 322           "between yields")                                                 \
 323           range(1, max_uintx)                                               \
 324           constraint(CMSBitMapYieldQuantumConstraintFunc,AfterMemoryInit)   \
 325                                                                             \
 326   product(bool, CMSPrintChunksInDump, false,                                \
 327           "If logging for the \"gc\" and \"promotion\" tags is enabled on"  \
 328           "trace level include more detailed information about the"         \
 329           "free chunks")                                                    \
 330                                                                             \
 331   product(bool, CMSPrintObjectsInDump, false,                               \
 332           "If logging for the \"gc\" and \"promotion\" tags is enabled on"  \
 333           "trace level include more detailed information about the"         \
 334           "allocated objects")                                              \
 335                                                                             \
 336   diagnostic(bool, FLSVerifyAllHeapReferences, false,                       \
 337           "Verify that all references across the FLS boundary "             \
 338           "are to valid objects")                                           \
 339                                                                             \
 340   diagnostic(bool, FLSVerifyLists, false,                                   \
 341           "Do lots of (expensive) FreeListSpace verification")              \
 342                                                                             \
 343   diagnostic(bool, FLSVerifyIndexTable, false,                              \
 344           "Do lots of (expensive) FLS index table verification")            \
 345                                                                             \
 346   product(uintx, CMSTriggerRatio, 80,                                       \
 347           "Percentage of MinHeapFreeRatio in CMS generation that is "       \
 348           "allocated before a CMS collection cycle commences")              \
 349           range(0, 100)                                                     \
 350                                                                             \
 351   product(uintx, CMSBootstrapOccupancy, 50,                                 \
 352           "Percentage CMS generation occupancy at which to "                \
 353           "initiate CMS collection for bootstrapping collection stats")     \
 354           range(0, 100)                                                     \
 355                                                                             \
 356   product(intx, CMSInitiatingOccupancyFraction, -1,                         \
 357           "Percentage CMS generation occupancy to start a CMS collection "  \
 358           "cycle. A negative value means that CMSTriggerRatio is used")     \
 359           range(min_intx, 100)                                              \
 360                                                                             \
 361   manageable(intx, CMSTriggerInterval, -1,                                  \
 362           "Commence a CMS collection cycle (at least) every so many "       \
 363           "milliseconds (0 permanently, -1 disabled)")                      \
 364           range(-1, max_intx)                                               \
 365                                                                             \
 366   product(bool, UseCMSInitiatingOccupancyOnly, false,                       \
 367           "Only use occupancy as a criterion for starting a CMS collection")\
 368                                                                             \
 369   product(uintx, CMSIsTooFullPercentage, 98,                                \
 370           "An absolute ceiling above which CMS will always consider the "   \
 371           "unloading of classes when class unloading is enabled")           \
 372           range(0, 100)                                                     \
 373                                                                             \
 374   develop(bool, CMSTestInFreeList, false,                                   \
 375           "Check if the coalesced range is already in the "                 \
 376           "free lists as claimed")                                          \
 377                                                                             \
 378   notproduct(bool, CMSVerifyReturnedBytes, false,                           \
 379           "Check that all the garbage collected was returned to the "       \
 380           "free lists")                                                     \
 381                                                                             \
 382   diagnostic(bool, BindCMSThreadToCPU, false,                               \
 383           "Bind CMS Thread to CPU if possible")                             \
 384                                                                             \
 385   diagnostic(uintx, CPUForCMSThread, 0,                                     \
 386           "When BindCMSThreadToCPU is true, the CPU to bind CMS thread to") \
 387           range(0, max_juint)                                               \
 388                                                                             \
 389   product(uintx, CMSCoordinatorYieldSleepCount, 10,                         \
 390           "Number of times the coordinator GC thread will sleep while "     \
 391           "yielding before giving up and resuming GC")                      \
 392           range(0, max_juint)                                               \
 393                                                                             \
 394   product(uintx, CMSYieldSleepCount, 0,                                     \
 395           "Number of times a GC thread (minus the coordinator) "            \
 396           "will sleep while yielding before giving up and resuming GC")     \
 397           range(0, max_juint)                                               \
 398                                                                             \
 399   product(bool, ParGCUseLocalOverflow, false,                               \
 400           "Instead of a global overflow list, use local overflow stacks")   \
 401                                                                             \
 402   product(bool, ParGCTrimOverflow, true,                                    \
 403           "Eagerly trim the local overflow lists "                          \
 404           "(when ParGCUseLocalOverflow)")                                   \
 405                                                                             \
 406   notproduct(bool, ParGCWorkQueueOverflowALot, false,                       \
 407           "Simulate work queue overflow in ParNew")                         \
 408                                                                             \
 409   notproduct(uintx, ParGCWorkQueueOverflowInterval, 1000,                   \
 410           "An `interval' counter that determines how frequently "           \
 411           "we simulate overflow; a smaller number increases frequency")     \
 412                                                                             \
 413   product(uintx, ParGCDesiredObjsFromOverflowList, 20,                      \
 414           "The desired number of objects to claim from the overflow list")  \
 415           range(0, max_uintx)                                               \
 416                                                                             \
 417   diagnostic(uintx, ParGCStridesPerThread, 2,                               \
 418           "The number of strides per worker thread that we divide up the "  \
 419           "card table scanning work into")                                  \
 420           range(1, max_uintx)                                               \
 421           constraint(ParGCStridesPerThreadConstraintFunc,AfterErgo)         \
 422                                                                             \
 423   diagnostic(intx, ParGCCardsPerStrideChunk, 256,                           \
 424           "The number of cards in each chunk of the parallel chunks used "  \
 425           "during card table scanning")                                     \
 426           range(1, max_intx)                                                \
 427           constraint(ParGCCardsPerStrideChunkConstraintFunc,AfterMemoryInit)
 428 
 429 #endif // SHARE_GC_CMS_CMS_GLOBALS_HPP