Skip to content

Set blockPermit for BLOCKING thread when lock is free #22215

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

Merged
merged 1 commit into from
Jul 14, 2025

Conversation

theresa-m
Copy link
Contributor

@theresa-m theresa-m commented Jul 11, 2025

Only set VirtualThread.blockPermit for a virtual thread in the BLOCKING state when the lock is available. This prevents virtual threads from being unblocked prematurely.

Fixes: #22077
Grinder: https://hyc-runtimes-jenkins.swg-devops.com/view/Test_grinder/job/Grinder/52611/

@theresa-m theresa-m force-pushed the vthreadmonitortest branch from 66d42ef to d30be2e Compare July 11, 2025 14:03
@theresa-m theresa-m marked this pull request as ready for review July 11, 2025 16:27
@theresa-m theresa-m requested a review from fengxue-IS July 11, 2025 16:27
{
omrthread_monitor_t monitor = syncObjectMonitor->monitor;
/* Only set the VirtualThread.blockPermit if thread is ready to be unblocked.
* All blocking/waiting monitor have to be inflated, if the monitor has not been inflated,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you update. the comment here to reflect only blocking/blocked need this check. also include that the BLOCKPERMIT will allow afterYield() function to reschedule the thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the comments for BLOCKED and BLOCKING.

@theresa-m theresa-m force-pushed the vthreadmonitortest branch from d30be2e to 133d822 Compare July 11, 2025 18:28
Copy link
Contributor

@fengxue-IS fengxue-IS left a comment

Choose a reason for hiding this comment

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

LGTM

@theresa-m theresa-m requested a review from babsingh July 11, 2025 19:08
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.

Minor nits.

@theresa-m theresa-m force-pushed the vthreadmonitortest branch from 0d240be to 0c50040 Compare July 14, 2025 13:06
@theresa-m
Copy link
Contributor Author

Thanks @babsingh I updated the code with your suggestions and fixed additional similar cases.

@babsingh
Copy link
Contributor

@theresa-m Can you squash the commits? The second commit has incorrect details: <[email protected]>.

Only set VirtualThread.blockPermit for a virtual thread
in the BLOCKING state when the lock is available. This
prevents virtual threads from being unblocked prematurely.

Signed-off-by: Theresa Mammarella <[email protected]>
@theresa-m theresa-m force-pushed the vthreadmonitortest branch from 0c50040 to b9639a8 Compare July 14, 2025 15:35
@theresa-m
Copy link
Contributor Author

@theresa-m Can you squash the commits? The second commit has incorrect details: <[email protected]>.

Done

@babsingh
Copy link
Contributor

jenkins test sanity amac jdk24

@babsingh babsingh merged commit 565e525 into eclipse-openj9:master Jul 14, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants