Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: nonZero max TLH size #7423

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion gc/base/GCExtensionsBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
#endif /* defined(OMR_GC_COMBINATION_SPEC) */

uintptr_t tlhMinimumSize;
uintptr_t tlhMaximumSize;
uintptr_t tlhMaximumSize; // to be removed
uintptr_t tlhMaximumSizeBatchCleared;
uintptr_t tlhMaximumSizeNonBatchCleared;
uintptr_t tlhInitialSize;
uintptr_t tlhIncrementSize;
uintptr_t tlhSurvivorDiscardThreshold; /**< below this size GC (Scavenger) will discard survivor copy cache TLH, if alloc not succeeded (otherwise we reuse memory for next TLH) */
Expand Down Expand Up @@ -1110,6 +1112,8 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {

MMINLINE uintptr_t getMinimumFreeEntrySize() { return tlhMinimumSize; }

MMINLINE uintptr_t getTlhMaximumSize() { return OMR_MAX(tlhMaximumSizeBatchCleared, tlhMaximumSizeNonBatchCleared); }

MMINLINE MM_Heap* getHeap() { return heap; }

MMINLINE void
Expand Down Expand Up @@ -1566,6 +1570,8 @@ class MM_GCExtensionsBase : public MM_BaseVirtual {
#endif /* defined(OMR_GC_COMBINATION_SPEC) */
, tlhMinimumSize(MINIMUM_TLH_SIZE)
, tlhMaximumSize(131072)
, tlhMaximumSizeBatchCleared(128 * 1024)
, tlhMaximumSizeNonBatchCleared(1024 * 1024)
, tlhInitialSize(2048)
, tlhIncrementSize(4096)
, tlhSurvivorDiscardThreshold(tlhMinimumSize)
Expand Down
4 changes: 2 additions & 2 deletions gc/base/MemoryPoolAddressOrderedList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ MM_MemoryPoolAddressOrderedList::initialize(MM_EnvironmentBase *env)
#if defined(OMR_GC_THREAD_LOCAL_HEAP)
/* this memoryPool can be used by scavenger, maximum tlh size should be max(_extensions->tlhMaximumSize, _extensions->scavengerScanCacheMaximumSize) */
#if defined(OMR_GC_MODRON_SCAVENGER)
uintptr_t tlhMaximumSize = OMR_MAX(_extensions->tlhMaximumSize, _extensions->scavengerScanCacheMaximumSize);
uintptr_t tlhMaximumSize = OMR_MAX(_extensions->getTlhMaximumSize(), _extensions->scavengerScanCacheMaximumSize);
#else /* OMR_GC_MODRON_SCAVENGER */
uintptr_t tlhMaximumSize = _extensions->tlhMaximumSize;
uintptr_t tlhMaximumSize = _extensions->getTlhMaximumSize();
#endif /* OMR_GC_MODRON_SCAVENGER */
_largeObjectAllocateStats = MM_LargeObjectAllocateStats::newInstance(env, (uint16_t)ext->largeObjectAllocationProfilingTopK, ext->largeObjectAllocationProfilingThreshold, ext->largeObjectAllocationProfilingVeryLargeObjectThreshold, (float)ext->largeObjectAllocationProfilingSizeClassRatio / (float)100.0,
_extensions->heap->getMaximumMemorySize(), tlhMaximumSize + _minimumFreeEntrySize, _extensions->tlhMinimumSize);
Expand Down
4 changes: 2 additions & 2 deletions gc/base/MemoryPoolLargeObjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ MM_MemoryPoolLargeObjects::initialize(MM_EnvironmentBase* env)
uintptr_t minimumFreeEntrySize = OMR_MAX(_memoryPoolLargeObjects->getMinimumFreeEntrySize(), _memoryPoolSmallObjects->getMinimumFreeEntrySize());
/* this memoryPool can be used by scavenger, maximum tlh size should be max(_extensions->tlhMaximumSize, _extensions->scavengerScanCacheMaximumSize) */
#if defined(OMR_GC_MODRON_SCAVENGER)
uintptr_t tlhMaximumSize = OMR_MAX(_extensions->tlhMaximumSize, _extensions->scavengerScanCacheMaximumSize);
uintptr_t tlhMaximumSize = OMR_MAX(_extensions->getTlhMaximumSize(), _extensions->scavengerScanCacheMaximumSize);
#else /* OMR_GC_MODRON_SCAVENGER */
uintptr_t tlhMaximumSize = _extensions->tlhMaximumSize;
uintptr_t tlhMaximumSize = _extensions->getTlhMaximumSize();
#endif /* OMR_GC_MODRON_SCAVENGER */
_largeObjectAllocateStats = MM_LargeObjectAllocateStats::newInstance(env, (uint16_t)_extensions->largeObjectAllocationProfilingTopK, _extensions->largeObjectAllocationProfilingThreshold, _extensions->largeObjectAllocationProfilingVeryLargeObjectThreshold, (float)_extensions->largeObjectAllocationProfilingSizeClassRatio / (float)100.0,
_extensions->heap->getMaximumMemorySize(), tlhMaximumSize + minimumFreeEntrySize, _extensions->tlhMinimumSize);
Expand Down
4 changes: 2 additions & 2 deletions gc/base/MemoryPoolSplitAddressOrderedListBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ class MM_MemoryPoolSplitAddressOrderedListBase : public MM_MemoryPoolAddressOrde
/* this memoryPool can be used by scavenger, maximum tlh size
* should be max(_extensions->tlhMaximumSize, _extensions->scavengerScanCacheMaximumSize)
*/
uintptr_t tlhMaximumSize = OMR_MAX(_extensions->tlhMaximumSize, _extensions->scavengerScanCacheMaximumSize);
uintptr_t tlhMaximumSize = OMR_MAX(_extensions->getTlhMaximumSize(), _extensions->scavengerScanCacheMaximumSize);
#else /* OMR_GC_MODRON_SCAVENGER */
uintptr_t tlhMaximumSize = _extensions->tlhMaximumSize;
uintptr_t tlhMaximumSize = _extensions->getTlhMaximumSize();
#endif /* OMR_GC_MODRON_SCAVENGER */
return tlhMaximumSize;
}
Expand Down
2 changes: 1 addition & 1 deletion gc/base/MemorySubSpaceSemiSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ MM_MemorySubSpaceSemiSpace::initialize(MM_EnvironmentBase *env)
_memorySubSpaceSurvivor->isAllocatable(false);

/* this memoryPool can be used by scavenger, maximum tlh size should be max(_extensions->tlhMaximumSize, _extensions->scavengerScanCacheMaximumSize) */
uintptr_t tlhMaximumSize = OMR_MAX(_extensions->tlhMaximumSize, _extensions->scavengerScanCacheMaximumSize);
uintptr_t tlhMaximumSize = OMR_MAX(_extensions->getTlhMaximumSize(), _extensions->scavengerScanCacheMaximumSize);
_largeObjectAllocateStats = MM_LargeObjectAllocateStats::newInstance(env, (uint16_t)_extensions->largeObjectAllocationProfilingTopK, _extensions->largeObjectAllocationProfilingThreshold, _extensions->largeObjectAllocationProfilingVeryLargeObjectThreshold, (float)_extensions->largeObjectAllocationProfilingSizeClassRatio / (float)100.0,
_extensions->heap->getMaximumMemorySize(), tlhMaximumSize + _extensions->minimumFreeEntrySize, _extensions->tlhMinimumSize);
if (NULL == _largeObjectAllocateStats) {
Expand Down
10 changes: 9 additions & 1 deletion gc/base/TLHAllocationSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,17 @@ MM_TLHAllocationSupport::refresh(MM_EnvironmentBase *env, MM_AllocateDescription
*/
uintptr_t sizeInBytesRequired = allocDescription->getContiguousBytes();
uintptr_t tlhMinimumSize = extensions->tlhMinimumSize;
uintptr_t tlhMaximumSize = extensions->tlhMaximumSize;
uintptr_t tlhMaximumSize = extensions->tlhMaximumSizeNonBatchCleared;

#if defined(OMR_GC_BATCH_CLEAR_TLH)
if (0 != extensions->batchClearTLH) {
tlhMaximumSize = extensions->tlhMaximumSizeBatchCleared;
}
#endif /* defined(OMR_GC_BATCH_CLEAR_TLH) */

uintptr_t halfRefreshSize = getRefreshSize() >> 1;
uintptr_t abandonSize = (tlhMinimumSize > halfRefreshSize ? tlhMinimumSize : halfRefreshSize);

if (sizeInBytesRequired > abandonSize) {
/* increase thread hungriness if we did not refresh */
if (getRefreshSize() < tlhMaximumSize && sizeInBytesRequired < tlhMaximumSize) {
Expand Down