On Thu, 11 May 2023 03:40:31 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> Paul Hohensee has updated the pull request incrementally with one additional >> commit since the last revision: >> >> 8304074: getTotalThreadAllocatedBytes name change, increment >> exited_allocated_bytes in ThreadService::remove_thread, add 64-bit atomic >> add for linux/bsd_x86, stub out for other platforms > > src/hotspot/share/services/management.cpp line 2107: > >> 2105: // twice, once in the loop and agsin in exited_allocated_bytes if >> it's >> 2106: // removed from the list after it's encountered in the loop but >> before >> 2107: // adding exited_allocated_bytes. > > This is not an accurate description. > > Once we have the TLH we have a fixed set of threads and none of them can > update exited_allocated_bytes. If we read exited_allocated_bytes while the > TLH is held then the count can be short for two reasons: > 1. Newly started threads > 2. Terminating threads that already escaped the TLH but which hadn't updated > exited_allocated_bytes by the time we read it. > AFAICS with the current logic there is no possibility of double-accounting. Sorry I thought you had made the change to only update exited_allocated_bytes after the thread removed itself from the threads-list. It really makes things so much simpler. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1190603367