RFR: 8308643: Incorrect value of 'used' jvmstat counter

Kim Barrett kbarrett at openjdk.org
Tue May 30 13:54:58 UTC 2023


On Tue, 30 May 2023 11:37:29 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Please review this change that fixes the space-used performance counters
>> provided by ParallelGC and SerialGC.
>> 
>> The prior fix for a problem in this area (JDK-8268265) wasn't correct.  It
>> used a static "last value" variable, for use when sampling is blocked by an
>> in-progress GC.  But there are multiple counters, so having one static "last
>> value" variable doesn't work.  (Not sure what I and my reviewers were thinking
>> at the time. Maybe we overlooked that there are multiple counters.)  The
>> solution is to associate a "last value" with each of the counters.
>> 
>> Also added a test of basic functionality (just accessibility) of the space
>> counters.  No regression test of the problem being fixed here, as its hard to
>> reliably set up.
>> 
>> Note: SpaceCounters and CSpaceCounters are very nearly identical.  It's likely
>> possible to refactor for more code sharing, which could be done as a followup.
>> 
>> Testing:
>> mach5 tier1
>
> src/hotspot/share/gc/parallel/spaceCounters.hpp line 42:
> 
>> 40:   PerfVariable*      _capacity;
>> 41:   PerfVariable*      _used;
>> 42:   volatile size_t    _last_used_in_bytes;
> 
> Why is an additional field required here? Can't `_used` fulfill the purpose?

The _used counters only seem to be updated by GCs.  The take_sample function reports "current" data.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14195#discussion_r1210309737


More information about the hotspot-gc-dev mailing list