-
Notifications
You must be signed in to change notification settings - Fork 728
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
JVMTI suspend and resume rework to remove the virtual thread list #16846
Comments
The above approach won't work because:
Another approach:
@gacholio Is it fine to set the |
It's not a bit, it's a mask of all halt bits excluding the suspend flag. |
I don't fully understand this statement due to lack of knowledge of VM access implementation. @gacholio Can you elaborate a little more? Does this mean we cannot suspend J9VMThreads under exclusive VM access? |
I think the EVMA approach will work. |
When you say "walk the heap" what do you mean? Walk the continuation list, or a linear walk of the entire heap? |
I was thinking of a Linear walk of the entire heap since it will also cover virtual threads that haven't started i.e. they haven't been added to the virtual thread list or the continuation list. @amicic @dmitripivkine @LinHu2016 Will it be possible to walk the continuation list from JVMTI? Will it work to suspend virtual threads considering it has weak references? #16855 a reference to Thread is introduced in the Continuation class. |
I'm wondering about dark matter - we have a special mode that keep the heap in a walkable state, but I can't recall what exactly that entails (i.e. what issues we might have if we're not in the safe mode). |
I've wrote the refactor PR to depend on GC list in JVMTI, if we use EVMA, then there shouldn't be any problems with that approach, heap walk doesn't seem to be needed in this case as we already have access to GC's list. weak reference doesn't matter since we are just setting fields in the vthread object for unmounted one right? |
I don't think linear walk of the heap is a good idea.
|
I didn't realize that @fengxue-IS has already updated the JVMTI functions in #16855. The change to iterate through the continuations list LGTM. We will have to set the |
Does the previous comment mean this PR is unnecessary now? |
This is just an issue. #16855 (PR) will close this issue once it employs EVMA in the JVMTI functions and initialization support for the |
@babsingh can we close this issue? |
Yes, it was fixed with #16855. |
This proposal updates the JVMTI suspend and resume mechanism for virtual threads so that it no longer has to rely on the virtual thread list. The end goal is to improve performance by removing the virtual thread list.
allVirtualThreadsSuspended
.jvmtiSuspendAllVirtualThreads
, setallVirtualThreadsSuspended
toTRUE
, and scan all carrier threads to suspend mounted virtual threads (similar tojvmtiGetAllThreads
).jvmtiResumeAllVirtualThreads
, setallVirtualThreadsSuspended
toFALSE
, and scan all carrier threads to resume mounted virtual threads (similar tojvmtiGetAllThreads
).JVM_VirtualThreadMountEnd
, set halt flag in the currentJ9VMThread
ifallVirtualThreadsSuspended
is set toTRUE
.jvmtiResumeThread
, setjava.lang.VirtualThread.isSuspendedByJVMTI
to a specific value, which will allow to mount the thread, ifallVirtualThreadsSuspended
is set toTRUE
. If the virtual thread is already mounted, only the halt flag needs to be cleared.jvmtiSuspendThread
, resetjava.lang.VirtualThread.isSuspendedByJVMTI
ifallVirtualThreadsSuspended
is set toTRUE
.jvmtiGetThreadState
, inspectallVirtualThreadsSuspended
andjava.lang.VirtualThread.isSuspendedByJVMTI
for setting theSUSPEND
flag.The text was updated successfully, but these errors were encountered: