Skip to content

Commit

Permalink
Merge pull request #19936 from amicic/maxTLH_noBatchClear
Browse files Browse the repository at this point in the history
Increase max TLH for non-batch clear platforms
  • Loading branch information
dmitripivkine authored Jul 31, 2024
2 parents 90ac2bf + 9574f68 commit 07797d6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions runtime/gc_base/GCExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ MM_GCExtensions::initialize(MM_EnvironmentBase *env)
getJavaVM()->jniArrayCacheMaxSize = J9_GC_JNI_ARRAY_CACHE_SIZE;
#endif /* J9VM_GC_JNI_ARRAY_CACHE */

/* We increase default max TLH size from OMR default value to allow non-batch clear TLH platforms to benefit from it.
* Platforms that use batch clearing (see batchClearTLH) will override later this with a smaller value */
tlhMaximumSize = J9_MAXIMUM_TLH_SIZE;

/* if tuned for virtualized environment, we compromise a bit of performance for lower footprint */
if (getJavaVM()->runtimeFlags & J9_RUNTIME_TUNE_VIRTUALIZED) {
heapFreeMinimumRatioMultiplier = 20;
Expand Down
9 changes: 9 additions & 0 deletions runtime/gc_base/GCExtensions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ class MM_IdleGCManager;
#define MINIMUM_SURVIVOR_MINIMUM_FREESIZE 512
#define MINIMUM_SURVIVOR_THRESHOLD 512


#define J9_MAXIMUM_TLH_SIZE (1024 * 1024)
#if defined(J9VM_GC_BATCH_CLEAR_TLH)
#define J9_MAXIMUM_TLH_SIZE_BATCH_CLEAR (128 * 1024)
#endif /* defined(J9VM_GC_BATCH_CLEAR_TLH) */

/**
* @todo Provide class documentation
* @ingroup GC_Base
Expand Down Expand Up @@ -193,6 +199,8 @@ class MM_GCExtensions : public MM_GCExtensionsBase {

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

bool tlhMaximumSizeSpecified; /**< true, if tlhMaximumSize specified by a command line option */

bool dynamicHeapAdjustmentForRestore; /**< If set to true, the default heuristic-calculated softmx is prioritized over the user-specified values. */
/**
* Values for com.ibm.oti.vm.VM.J9_JIT_STRING_DEDUP_POLICY
Expand Down Expand Up @@ -417,6 +425,7 @@ class MM_GCExtensions : public MM_GCExtensionsBase {
, objectListFragmentCount(0)
, numaCommonThreadClassNamePatterns(NULL)
, userSpecifiedParameters()
, tlhMaximumSizeSpecified(false)
, dynamicHeapAdjustmentForRestore(false)
, stringDedupPolicy(J9_JIT_STRING_DEDUP_POLICY_UNDEFINED)
, _asyncCallbackKey(-1)
Expand Down
11 changes: 10 additions & 1 deletion runtime/gc_modron_startup/mmhelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ extern void initializeVerboseFunctionTableWithDummies(J9MemoryManagerVerboseInte
void
allocateZeroedTLHPages(J9JavaVM *javaVM, UDATA flag)
{
MM_GCExtensions::getExtensions(javaVM)->batchClearTLH = (flag != 0) ? 1 : 0;
MM_GCExtensions *ext = MM_GCExtensions::getExtensions(javaVM);

ext->batchClearTLH = (flag != 0) ? 1 : 0;

/* For batch clearing limit maximum size (since clearing too much may flush useful data from CPU data caches).
* Apply the limit only if user did not specify another value.
*/
if ((1 == ext->batchClearTLH) && !ext->tlhMaximumSizeSpecified) {
ext->tlhMaximumSize = OMR_MIN(J9_MAXIMUM_TLH_SIZE_BATCH_CLEAR, ext->tlhMaximumSize);
}
}

/**
Expand Down
1 change: 1 addition & 0 deletions runtime/gc_modron_startup/mmparseXgc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ j9gc_initialize_parse_gc_colon(J9JavaVM *javaVM, char **scan_start)
if(!scan_udata_helper(javaVM, scan_start, &extensions->tlhMaximumSize, "tlhMaximumSize=")) {
goto _error;
}
extensions->tlhMaximumSizeSpecified = true;
goto _exit;
}
if(try_scan(scan_start, "tlhIncrementSize=")) {
Expand Down

0 comments on commit 07797d6

Please sign in to comment.