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

Write and clear stack trace table outside of safepoint

    XMLWordPrintable

Details

    • jfr
    • b11

    Backports

      Description

        When the chunk rotates, serializing the stack trace table happens in two passes: 1) the pre-safepoint writes as much as possible but does not delete nodes. 2) The safepoint writes new entries incrementally and deletes nodes in addition to resetting buckets.

        Since a global lock protects the stack trace table, hoisting the deletes and clearing the table outside safepoints makes sense. Doing so will minimize the stack trace table work needed during the safepoint. The tradeoff is that an identical stack trace can be written twice. However, this is low risk because the pre-safepoint and the safepoint operations happen back to back (i.e. there is only a tiny window for inserting a new stack trace).

        For example:

        diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp
        index a9f0cecb53c..8b019cbc8a2 100644
        --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp
        +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp
        @@ -573,9 +573,7 @@ void JfrRecorderService::pre_safepoint_write() {
             ObjectSampleCheckpoint::on_rotation(ObjectSampler::acquire());
           }
           write_storage(_storage, _chunkwriter);
        - if (_stack_trace_repository.is_modified()) {
        - write_stacktrace(_stack_trace_repository, _chunkwriter, false);
        - }
        + write_stacktrace(_stack_trace_repository, _chunkwriter, true); // true == clear the table
         }

         void JfrRecorderService::invoke_safepoint_write() {

        Attachments

          Issue Links

            Activity

              People

                mgronlun Markus Grönlund
                mgronlun Markus Grönlund
                Votes:
                0 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: