Skip to content

Commit 07797d6

Browse files
Merge pull request #19936 from amicic/maxTLH_noBatchClear
Increase max TLH for non-batch clear platforms
2 parents 90ac2bf + 9574f68 commit 07797d6

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

runtime/gc_base/GCExtensions.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ MM_GCExtensions::initialize(MM_EnvironmentBase *env)
103103
getJavaVM()->jniArrayCacheMaxSize = J9_GC_JNI_ARRAY_CACHE_SIZE;
104104
#endif /* J9VM_GC_JNI_ARRAY_CACHE */
105105

106+
/* We increase default max TLH size from OMR default value to allow non-batch clear TLH platforms to benefit from it.
107+
* Platforms that use batch clearing (see batchClearTLH) will override later this with a smaller value */
108+
tlhMaximumSize = J9_MAXIMUM_TLH_SIZE;
109+
106110
/* if tuned for virtualized environment, we compromise a bit of performance for lower footprint */
107111
if (getJavaVM()->runtimeFlags & J9_RUNTIME_TUNE_VIRTUALIZED) {
108112
heapFreeMinimumRatioMultiplier = 20;

runtime/gc_base/GCExtensions.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ class MM_IdleGCManager;
8181
#define MINIMUM_SURVIVOR_MINIMUM_FREESIZE 512
8282
#define MINIMUM_SURVIVOR_THRESHOLD 512
8383

84+
85+
#define J9_MAXIMUM_TLH_SIZE (1024 * 1024)
86+
#if defined(J9VM_GC_BATCH_CLEAR_TLH)
87+
#define J9_MAXIMUM_TLH_SIZE_BATCH_CLEAR (128 * 1024)
88+
#endif /* defined(J9VM_GC_BATCH_CLEAR_TLH) */
89+
8490
/**
8591
* @todo Provide class documentation
8692
* @ingroup GC_Base
@@ -193,6 +199,8 @@ class MM_GCExtensions : public MM_GCExtensionsBase {
193199

194200
UserSpecifiedParameters userSpecifiedParameters; /**< A collection of user-speicifed parameters */
195201

202+
bool tlhMaximumSizeSpecified; /**< true, if tlhMaximumSize specified by a command line option */
203+
196204
bool dynamicHeapAdjustmentForRestore; /**< If set to true, the default heuristic-calculated softmx is prioritized over the user-specified values. */
197205
/**
198206
* Values for com.ibm.oti.vm.VM.J9_JIT_STRING_DEDUP_POLICY
@@ -417,6 +425,7 @@ class MM_GCExtensions : public MM_GCExtensionsBase {
417425
, objectListFragmentCount(0)
418426
, numaCommonThreadClassNamePatterns(NULL)
419427
, userSpecifiedParameters()
428+
, tlhMaximumSizeSpecified(false)
420429
, dynamicHeapAdjustmentForRestore(false)
421430
, stringDedupPolicy(J9_JIT_STRING_DEDUP_POLICY_UNDEFINED)
422431
, _asyncCallbackKey(-1)

runtime/gc_modron_startup/mmhelpers.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,16 @@ extern void initializeVerboseFunctionTableWithDummies(J9MemoryManagerVerboseInte
6363
void
6464
allocateZeroedTLHPages(J9JavaVM *javaVM, UDATA flag)
6565
{
66-
MM_GCExtensions::getExtensions(javaVM)->batchClearTLH = (flag != 0) ? 1 : 0;
66+
MM_GCExtensions *ext = MM_GCExtensions::getExtensions(javaVM);
67+
68+
ext->batchClearTLH = (flag != 0) ? 1 : 0;
69+
70+
/* For batch clearing limit maximum size (since clearing too much may flush useful data from CPU data caches).
71+
* Apply the limit only if user did not specify another value.
72+
*/
73+
if ((1 == ext->batchClearTLH) && !ext->tlhMaximumSizeSpecified) {
74+
ext->tlhMaximumSize = OMR_MIN(J9_MAXIMUM_TLH_SIZE_BATCH_CLEAR, ext->tlhMaximumSize);
75+
}
6776
}
6877

6978
/**

runtime/gc_modron_startup/mmparseXgc.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ j9gc_initialize_parse_gc_colon(J9JavaVM *javaVM, char **scan_start)
7373
if(!scan_udata_helper(javaVM, scan_start, &extensions->tlhMaximumSize, "tlhMaximumSize=")) {
7474
goto _error;
7575
}
76+
extensions->tlhMaximumSizeSpecified = true;
7677
goto _exit;
7778
}
7879
if(try_scan(scan_start, "tlhIncrementSize=")) {

0 commit comments

Comments
 (0)