RFR: 8258431: Provide a JFR event with live set size estimate [v9]

Jaroslav Bachorik jbachorik at openjdk.java.net
Mon Mar 8 17:17:11 UTC 2021


On Wed, 3 Mar 2021 12:13:43 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> Jaroslav Bachorik has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add tests for the heap usage summary event
>
> src/hotspot/share/gc/shared/space.hpp line 553:
> 
>> 551:   size_t capacity() const        { return byte_size(bottom(), end()); }
>> 552:   size_t used() const            { return byte_size(bottom(), top()); }
>> 553:   size_t live() const            {
> 
> The code for serial gc, contrary to others, tries to give some resemblance of tracking actual liveness. I.e. calculating this anew every call to `SerialHeap::live()`.
> However if calling an `update_live_estimate()` in parallel and G1 (and the other collectors) is fine at certain places, this should be as good for serial gc.
> Doing so would reduce the footprint of this change quite a bit (for serial gc)

Ok. I am caching the live estimate per memory space now. 
Not sure how much it will change the footprint of this change, though, but it is good for consistency anyway.

> src/hotspot/share/gc/shared/space.inline.hpp line 128:
> 
>> 126:           p2i(dead_start), p2i(dead_end), dead_length * HeapWordSize);
>> 127: 
>> 128:       _dead_space += dead_length;
> 
> I do not think adding this to the counter here instead of the other method for every object makes a difference performance-wise.
> 
> As mentioned before, `_allowed_deadspace_words` counts *down* from `(space->capacity() * ratio / 100) / HeapWordSize;` to whatever end value.
> 
> So at the end of collection, `(space->capacity() * ratio / 100) / HeapWordSize - _allowed_deadspace_words` should be equal to what `_dead_space` is now.
> 
> Please add a getter to `DeadSpacer` that calculates this (factoring out the calculation of the maximum allowed deadspace).

Fixed in https://github.com/openjdk/jdk/pull/2579/commits/f708023b84e33aee34f92d183a0d03d2747646db

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

PR: https://git.openjdk.java.net/jdk/pull/2579



More information about the hotspot-gc-dev mailing list