-
Notifications
You must be signed in to change notification settings - Fork 729
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
Avoid to scan the finished Continuation Object #16454
Conversation
@amicic please review the change, Thanks |
runtime/oti/VMHelpers.hpp
Outdated
@@ -2151,8 +2152,9 @@ class VM_VMHelpers | |||
* For fully STW GCs, there is no harm to scan them, but it's a waste of time since they are scanned during root scanning already. | |||
* | |||
* We don't scan currently scanned either - one scan is enough. | |||
* we don't/no need scan the continuation object before started and after finished. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's clear what we do but not why, add: - java stack does not exist
9cef927
to
b74434a
Compare
Jenkins test sanity win jdk19 |
b74434a
to
af774ef
Compare
runtime/oti/VMHelpers.hpp
Outdated
needScan = started && (NULL != continuation) && (!isContinuationMountedOrConcurrentlyScanned(continuation)); | ||
if ((NULL != continuation) && (!isContinuationMountedOrConcurrentlyScanned(continuation))) { | ||
needScan = !J9VMJDKINTERNALVMCONTINUATION_FINISHED(vmThread, continuationObject); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was wrong with the previous version of this check?
needScan = started && !finished && (NULL != continuation) && (!isContinuationMountedOrConcurrentlyScanned(continuation));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, I suspect this is not quite correct order, since setting started flag should be the last thing.
as it's now, it opens a possibility that a third party prematurely starts consuming stack by seeing started flag being set
openj9/runtime/vm/ContinuationHelpers.cpp
Line 168 in 39bceb2
*--currentThread->sp = (UDATA)continuationObject; |
e34ac46
to
6dfd732
Compare
acf5e75
to
d5d7547
Compare
runtime/gc_base/GCExtensions.cpp
Outdated
*/ | ||
if (started && !finished) { | ||
Assert_MM_true(NULL != continuation); | ||
needScan = !isContinuationMountedOrConcurrentlyScanned(continuation); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this won't compile (needs VM_Helpers:: scope, but then it begs a question should more helpers move, as well.
Another dilemma is where we put all of this. For APIs that are used only by GC, this file/class might be slightly better than generic VMHelpers, but possible even better is ContinuationHelpers?
1bd709e
to
fa3cb1e
Compare
jenkins test sanity aix jdk19 |
@@ -311,3 +312,30 @@ MM_GCExtensions::releaseNativesForContinuationObject(MM_EnvironmentBase* env, j9 | |||
} | |||
#endif /* JAVA_SPEC_VERSION >= 19 */ | |||
} | |||
|
|||
bool | |||
MM_GCExtensions::needScanStacksForContinuationObject(J9VMThread *vmThread, j9object_t objectPtr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to make this static
(and releaseNativesForContinuationObject as well - not possible, because it uses member continuationListOption)
fa3cb1e
to
08fcca9
Compare
copyright check (year is 2023 now) |
There is no need to scan any continuation Objects, which are marked finished, plus there could be potential race condition between continuation concurrent scan and continuation free up for finished Continuation Object. Signed-off-by: Lin Hu <linhu@ca.ibm.com>
08fcca9
to
a9e4bc9
Compare
jenkins test sanity win jdk19 |
There is no need to scan any continuation Objects, which are marked finished, plus there could be potential race condition between continuation concurrent scan and continuation free up for finished Continuation Object.
fix:#15939 (comment)
Signed-off-by: Lin Hu linhu@ca.ibm.com