Skip to content

Commit

Permalink
Use gcThreadCountSpecified
Browse files Browse the repository at this point in the history
Make use of newly introduced gcThreadCountSpecified flag so that when
command line options (such as Java's -Xgcthreads or -Xgcmaxthreads) are
specified, GC thread count overrides the default count calculation.

Old gcThreadCountForced flag is still used, butin ParallelDispatcher to
distinguish between force/fixed or adaptive count of threads, bufore
deciding how many threads to use for a ParallelTask.

Another change is that during the snapshot VM creation when thread count
is reduced to checkpointGCthreadCount, we don't adjust GCExtensions
gcThreadCount anymore (only ParallelDispatcher is affected). This is to
be able to carry over the original count (from snapshot VM) to restore
VM, so that options that specify that count can be obeyed even on
restore side.
  • Loading branch information
Aleksandar Micic authored and Aleksandar Micic committed Dec 19, 2023
1 parent 82956e0 commit e4bf396
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
3 changes: 1 addition & 2 deletions gc/base/Configuration.cpp
Expand Up @@ -447,8 +447,7 @@ MM_Configuration::initializeGCThreadCount(MM_EnvironmentBase* env)
{
MM_GCExtensionsBase* extensions = env->getExtensions();

/* to be checked against gcThreadCountSpecified, once downstream projects properly set it */
if (!extensions->gcThreadCountForced) {
if (!extensions->gcThreadCountSpecified) {
extensions->gcThreadCount = defaultGCThreadCount(env);
}
}
Expand Down
2 changes: 0 additions & 2 deletions gc/base/ParallelDispatcher.cpp
Expand Up @@ -701,7 +701,6 @@ MM_ParallelDispatcher::contractThreadPool(MM_EnvironmentBase *env, uintptr_t new

Assert_MM_true(_threadShutdownCount == expectedThreadShutdownThread);

_extensions->gcThreadCount = newThreadCount;
_activeThreadCount = newThreadCount;
_threadCount = newThreadCount;
_threadCountMaximum = newThreadCount;
Expand Down Expand Up @@ -748,7 +747,6 @@ MM_ParallelDispatcher::expandThreadPool(MM_EnvironmentBase *env)
newThreadCount = _threadShutdownCount + 1;
}

_extensions->gcThreadCount = newThreadCount;
_threadCount = newThreadCount;
_threadCountMaximum = newThreadCount;
}
Expand Down

0 comments on commit e4bf396

Please sign in to comment.