Skip to content

Commit

Permalink
initializeGCParameters For CRIU Restore
Browse files Browse the repository at this point in the history
Relates to
eclipse-openj9/openj9#17459 (comment)

Signed-off-by: Salman Rana <salman.rana@ibm.com>
  • Loading branch information
RSalman committed Jun 16, 2023
1 parent 5d0dba6 commit ffb32d3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
24 changes: 24 additions & 0 deletions gc/base/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,3 +525,27 @@ MM_Configuration::createParallelDispatcher(MM_EnvironmentBase *env, omrsig_handl
{
return MM_ParallelDispatcher::newInstance(env, handler, handler_arg, defaultOSStackSize);
}

#if defined(J9VM_OPT_CRIU_SUPPORT)
bool
MM_Configuration::reinitializeForRestore(MM_EnvironmentBase* env)
{
MM_GCExtensionsBase *extensions = env->getExtensions();

/* The initialization of the GC thread count can only happen if it is not enforced by the user. */
initializeGCThreadCount(env);

/* Currently, threads don't shutdown during reinitialization, so it is important to
* prevent the thread count from dropping below the number of checkpoint threads.
* This adjustment may no longer be necessary in the future once the shutdown behavior
* of dispatcher threads during restore is thoroughly tested.
*/
extensions->gcThreadCount = OMR_MAX(
extensions->dispatcher->threadCountMaximum(),
extensions->gcThreadCount);

initializeGCParameters(env);

return true;
}
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */
6 changes: 1 addition & 5 deletions gc/base/Configuration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,7 @@ class MM_Configuration : public MM_BaseVirtual
* @param[in] env the current environment.
* @return boolean indicating whether the configuration was successfully updated.
*/
virtual bool reinitializeForRestore(MM_EnvironmentBase* env)
{
Assert_MM_unreachable();
return false;
}
virtual bool reinitializeForRestore(MM_EnvironmentBase* env);
#endif /* defined(J9VM_OPT_CRIU_SUPPORT) */

MM_Configuration(MM_EnvironmentBase* env, MM_GCPolicy gcPolicy, MM_AlignmentType alignmentType, uintptr_t defaultRegionSize, uintptr_t defaultArrayletLeafSize, MM_GCWriteBarrierType writeBarrierType, MM_GCAllocationType allocationType)
Expand Down
4 changes: 3 additions & 1 deletion gc/base/standard/ConfigurationStandard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ MM_ConfigurationStandard::createHeapRegionManager(MM_EnvironmentBase* env)
bool
MM_ConfigurationStandard::reinitializeForRestore(MM_EnvironmentBase* env)
{
MM_GCExtensionsBase* extensions = env->getExtensions();
MM_GCExtensionsBase *extensions = env->getExtensions();

MM_Configuration::reinitializeForRestore(env);

MM_MemoryPool *memoryPool;
MM_HeapMemoryPoolIterator poolIterator(env, extensions->heap);
Expand Down

0 comments on commit ffb32d3

Please sign in to comment.