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

Avoid using a spinlock as the synchronization point returning from native in CPU Time Profiler

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • 25
    • 25
    • hotspot
    • None
    • jfr

      JfrThreadSampling.cpp (353 - 360):

      static void drain_enqueued_cpu_time_requests(const JfrTicks& now, JfrThreadLocal* tl, JavaThread* jt, Thread* current, bool lock) {
        assert(tl != nullptr, "invariant");
        assert(jt != nullptr, "invariant");
        assert(current != nullptr, "invariant");
      #ifdef LINUX
        tl->set_do_async_processing_of_cpu_time_jfr_requests(false);
        if (lock) {
          tl->acquire_cpu_time_jfr_dequeue_lock(); <<---

      This is your synchronization point on return from native code, which is effectively a spinlock. This can cause problems when a large number of threads are being processed by the "do_async_processing" request call.

      We should fix this as a bug after integration (use a proper Monitor as a synchronization point).

            jbechberger Johannes Bechberger
            mgronlun Markus Grönlund
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: