On Thu, 25 May 2023 09:01:14 GMT, Kevin Walls <kev...@openjdk.org> wrote:

>> src/hotspot/share/services/management.cpp line 2104:
>> 
>>> 2102:     // the final result can only be short due to (1) threads that 
>>> start after
>>> 2103:     // the TLH is created, or (2) terminating threads that escape TLH 
>>> creation
>>> 2104:     // and don't update exited_allocated_bytes before we initialize 
>>> result.
>> 
>> Okay this is why you can't do monotonicity check in the tests. Imagine we 
>> have 10 threads all live and we call this function and so tally up all 10 
>> threads. The next time we call this 5 of the threads are in the process of 
>> terminating - they have escaped the TLH but not yet updated the 
>> exited_allocated_bytes - so now we only tally up 5 threads and so the total 
>> appears to be far less than last time.
>
> The tests and all apps might thank us for keeping last known value, and not 
> returning anything lower, ensuring montonicity.

Fixed using a high water mark.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1207049618

Reply via email to