RFR: 8343177: JFR: Remove critical section for thread id assignment
Markus Grönlund
mgronlun at openjdk.org
Wed Oct 30 11:32:06 UTC 2024
On Wed, 30 Oct 2024 05:38:35 GMT, David Holmes <dholmes at openjdk.org> wrote:
> Sorry I struggled to map the code changes to the description of the changes. I think I'm missing some background context here - what is the "traceid" of a thread?
A traceid is a unique, monotonic ID that JFR assigns to artifacts (instances) (Threads, Klasses, Methods, Symbols).
Invariant; no reuse of IDs.
With Loom, unique monotonic ID is intrinsic to the tid field of the threadObj.
> src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 106:
>
>> 104: assert(Thread::is_starting_thread(jt), "invariant");
>> 105: assert(jt->threadObj() == nullptr, "invariant");
>> 106: jt->jfr_thread_local()->_jvm_thread_id = 1;
>
> Is this supposed to reflect the `java.lang.Thread` thread-id? If so this is changing to 3 with the object monitor virtual thread changes.
If the primordial thread ID assignment is changed from 1 to 3, then that will have to be updated, of course.
> src/hotspot/share/jfr/support/jfrThreadLocal.cpp line 438:
>
>> 436:
>> 437: #ifdef ASSERT
>> 438: static bool assignment_precondition(const Thread* t, JfrThreadLocal* tl) {
>
> Suggestion:
>
> static bool can_assign(const Thread* t, JfrThreadLocal* tl) {
Good suggestion.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21756#issuecomment-2446715237
PR Review Comment: https://git.openjdk.org/jdk/pull/21756#discussion_r1822423968
PR Review Comment: https://git.openjdk.org/jdk/pull/21756#discussion_r1822424296
More information about the hotspot-jfr-dev
mailing list