Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8249004

Reduce ThreadListHandle overhead in relation to direct handshakes

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 16
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:

      Description

      The implementation of execute_direct is as follows:

      bool Handshake::execute_direct(HandshakeClosure* thread_cl, JavaThread* target) {
        JavaThread* self = JavaThread::current();
        HandshakeOperation op(thread_cl, /*is_direct*/ true);

        jlong start_time_ns = os::javaTimeNanos();

        ThreadsListHandle tlh;
        if (tlh.includes(target)) {
          target->set_handshake_operation(&op);

      It needs the ThreadsListHandle to ensure the target thread is alive, and will remain alive, for the duration of the operation.

      However, in some cases when dealing with direct handshakes, the higher-level operation already has to have a ThreadsListHandle active to guard the target thread for the same reasons. In such cases the overhead of the TLH in execute_direct is unnecessary.

      We should provide an alternative version of execute_direct that allows us to rely on the outer TLH.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: