Repository navigation
CORE-96: Sempar - Verify thread binding against its reservation - #211
Open
peter-lawrey wants to merge 7 commits into
Open
peter-lawrey wants to merge 7 commits into
peter-lawrey wants to merge 7 commits into
Conversation
peter-lawrey
force-pushed
the
bugfix/core-96-sempar-aff-7
branch
from
November 11, 2026 14:44
93587e4 to
76ac5fc
Compare
amilbourne
approved these changes
Nov 16, 2026
amilbourne
left a comment
Contributor
There was a problem hiding this comment.
Looks OK - Although javadoc could be better
This was referenced Nov 30, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Seeing a thread run on the requested CPU does not tell a benchmark whether the OS can move it to another CPU.
AffinityLock.checkBound()compares the caller’s reservation with its current native affinity mask.VERIFIEDmeans the caller owns a bound reservation and the mask allows only the reserved CPU.MISMATCHcovers an unallocated lock, another thread’s reservation, a reservation without binding, or a mask that allows a different or additional CPU.UNKNOWNmeans the backend cannot supply a usable mask for that check.The result includes a reason and a defensive copy of the observed mask when available.
Affinity.describeCurrentThread()reports the thread name, backend and allowed mask. Both calls observe the current state without changing affinity.The Linux writer records the native owner TID, UTC acquisition time, current owner's start time and PID namespace after the two legacy lines. A reservation transferred from thread A to B keeps its acquisition time. Java callers can read the same immutable observation through
lock.reservationOwner()andAffinityLock.currentThreadReservation(). These lookups use in-memory state.The branch incorporates the paired-acquisition rollback from #215. If the second CPU cannot be reserved, the first is released. Handoff updates use the held descriptor, including when the receiving thread is interrupted.
Linux verification on JDK 21 ran 92 module tests with 90 passed and two JNI clock tests skipped. A separate JVM observed a reserve, handoff, forced owner exit and subsequent reacquisition. The reader in #210 and JLBH's run-end report agreed on the live PID, native TID and UTC instants.
Release note
Affinity can report the native owner and age of a CPU reservation, including ownership transfers.