RFR: 8352251: Implement JEP 518: JFR Cooperative Sampling [v23]

Markus Grönlund mgronlun at openjdk.org
Tue May 20 16:44:58 UTC 2025


On Tue, 20 May 2025 16:30:31 GMT, Markus Grönlund <mgronlun at openjdk.org> wrote:

>>> > > Where do you suggest to place it best?
>>> > 
>>> > 
>>> > Should be in `FreezeBase::unwind_frames()`. That's where we change the anchor to the ContinuationEntry.
>>> 
>>> Fixed. Thanks.
>>>
>> Thanks. Ideally we would avoid the extra overhead for the freeze fast path. We could always force the slow path when creating the sample request by setting _cont_fastpath_thread_state, which currently is only used for JVMTI to force the slow path on interpreted only mode. But I could take care of that as a follow up if you want. Can we inline the has_sample_request() check to avoid the call on the common case?
>
>> That is very good spotted indeed. There is a race here if the top frame is invalidated and we just go with the sender (it would describe the carrier frames for the vthread, something I had some problems with in the very beginning).
>> 
>> My neurons about Continuations and "rbp in continuations" are unfortunately way off in DRAM, on some remote NUMA node to boot.
>> 
>> Can you help me think out how to handle the Continuation specific things in parsing here?
> 
> We reasoned out a way to accomplish this. But not only that, there is actually a way to write ALL sample requests, by selecting the thread id as a function of the sampled frame. This means a mounted vthread will be able to write a sample and attribute it correctly to its carrier thread.

> > > > Where do you suggest to place it best?
> > > 
> > > 
> > > Should be in `FreezeBase::unwind_frames()`. That's where we change the anchor to the ContinuationEntry.
> > 
> > 
> > Fixed. Thanks.
> 
> Thanks. Ideally we would avoid the extra overhead for the freeze fast path. We could always force the slow path when creating the sample request by setting _cont_fastpath_thread_state, which currently is only used for JVMTI to force the slow path on interpreted only mode. But I could take care of that as a follow up if you want. Can we inline the has_sample_request() check to avoid the call on the common case?

Yes, I will try to see what can be done.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24296#discussion_r2098435447


More information about the hotspot-jfr-dev mailing list