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

Support using threadStatus field in JVM native #21043

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fengxue-IS
Copy link
Contributor

@fengxue-IS fengxue-IS commented Jan 30, 2025

Update thread status changes to j.l.Thread fields so getState() API
can be called without needing to halt the target thread.

Rework of #20550

Extension repo changes:
JDK21: ibmruntimes/openj9-openjdk-jdk21#246
JDK24: ibmruntimes/openj9-openjdk-jdk24#18
JDKnext: ibmruntimes/openj9-openjdk-jdk#927

Fixes: #17251

Co-authored-by: Nathan Henderson [email protected]
Signed-off-by: Jack Lu [email protected]

@fengxue-IS fengxue-IS force-pushed the threadstate2 branch 2 times, most recently from 6528e33 to aa845d1 Compare January 30, 2025 21:57
@fengxue-IS
Copy link
Contributor Author

Personal test build on JDK 8 & 21

@fengxue-IS
Copy link
Contributor Author

@babsingh can you please take a look

Copy link
Contributor

@babsingh babsingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM functionally. Minor nits.

For JDK21+, the j.l.Thread implementation is different. Have you opened the extension repo PRs? Will we need to coordinate the merge between this PR and the extension repo PRs?

Which JDK versions (11,17,21) and test suites (sanity.functional,sanity.openjdk) have you used to test these changes in your personal build?

jcl/src/java.base/share/classes/java/lang/Thread.java Outdated Show resolved Hide resolved
runtime/vm/threadhelp.cpp Outdated Show resolved Hide resolved
runtime/vm/threadpark.cpp Outdated Show resolved Hide resolved
@babsingh
Copy link
Contributor

Can you also squash the commits and link this PR to the following perf issue: #17251?

@babsingh
Copy link
Contributor

@gacholio Can you also review these changes?

@fengxue-IS
Copy link
Contributor Author

For JDK21+, the j.l.Thread implementation is different. Have you opened the extension repo PRs? Will we need to coordinate the merge between this PR and the extension repo PRs?

Yes, I've opened PR for 21 & JDK next, see PR referenced above. will also include the link in PR description.
And yes the PR's would require a coordinated merge with extension repo

Which JDK versions (11,17,21) and test suites (sanity.functional,sanity.openjdk) have you used to test these changes in your personal build?

Testing have been done for 8,11,21 with sanity.functional & sanity.openjdk on xlinux

Copy link
Contributor

@gacholio gacholio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good as far as it goes. We should attempt to transition to using the state field everywhere instead of attempting to derive it from various other states and bits (in a future PR).

@gacholio
Copy link
Contributor

gacholio commented Feb 3, 2025

Please squash the commits.

@fengxue-IS
Copy link
Contributor Author

I've created the extension change for JDK24, will test removing the sync block in JDK21+ locally to see if it is still needed after the started check have been moved before checking eetop

@gacholio
Copy link
Contributor

gacholio commented Feb 4, 2025

Beware the possibility of out-of-order memory operations.

fengxue-IS and others added 2 commits February 6, 2025 17:07
Update thread status changes to j.l.Thread fields so getState() API
can be called without needing to halt the target thread.

Co-authored-by: Nathan Henderson <[email protected]>
Signed-off-by: Jack Lu <[email protected]>
@fengxue-IS
Copy link
Contributor Author

squashed commits, updated extension changes

@babsingh
Copy link
Contributor

babsingh commented Feb 6, 2025

translateJ9VMThreadStateToThreadState feedback for the switch case statement and missing param[in] also needs to be applied to the extension repo PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thread::getState is a scalability issue
3 participants