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

Reduce ThreadsListHandle overhead in relation to direct handshakes

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 16
    • 18
    • hotspot
    • b23

    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

        Issue Links

          Activity

            People

              dcubed Daniel Daugherty
              dholmes David Holmes
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: