RFR: 8366082: Improve queue size computation in CPU-time sampler
Francesco Andreuzzi
duke at openjdk.org
Mon Aug 25 14:25:57 UTC 2025
On Mon, 25 Aug 2025 14:21:30 GMT, Johannes Bechberger <jbechberger at openjdk.org> wrote:
>> src/hotspot/share/jfr/periodic/sampling/jfrCPUTimeThreadSampler.cpp line 186:
>>
>>> 184: if (factor > 1) {
>>> 185: u4 new_capacity = _capacity * factor > CPU_TIME_QUEUE_MAX_CAPACITY ? CPU_TIME_QUEUE_MAX_CAPACITY : capacity * factor;
>>> 186: set_capacity(new_capacity);
>>
>> Is it a problem if another thread changes `_capacity` since when you read it at L171, and the update is overwritten?
>
> No other thread can change it. The queue capacity is only changed when
> - a thread is created (so queue drainage is possible in parallel
> - when the queue is drained and there is sample loss (but this happens only with a dequeue lock)
> - a thread is terminated: I added synchronisation to prevent concurrency
Thanks for the clarification
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26926#discussion_r2298259049
More information about the hotspot-jfr-dev
mailing list