RFR: Usage tracking cleanup
William Kemper
wkemper at openjdk.org
Tue Apr 18 22:50:20 UTC 2023
On Tue, 18 Apr 2023 21:33:59 GMT, Y. Srinivas Ramakrishna <ysr at openjdk.org> wrote:
>> There are many nuances to tracing memory utilization. Shenandoah track's usage, waste by humongous objects, padding for promotion LABs alignment and all this is also tracked by generation, the heap and feeds into the heuristics and the pacer. The code to update all of these values and route them to the right places was spread across the allocation call stack. This change consolidates all of the logic into one method, invoked near the end of the allocation.
>
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 333:
>
>> 331:
>> 332: if (size >= adjusted_min_size) {
>> 333: result = allocated_aligned_plab(size, req, r);
>
> `allocate_..`
Oops, good catch.
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 373:
>
>> 371: // Allocation successful, bump stats:
>> 372: if (req.is_mutator_alloc()) {
>> 373: increase_used(req.actual_size() * HeapWordSize);
>
> ~~There is leakage of abstraction happening here. I'd prefer if the adjustments of heap use occurred when the space was allocated by the region. That avoids accounting errors because of piecemeal adjustments scattered along the allocation paths here.~~
>
> I withdraw this comment; I probably need to get a better picture of where the adjustments are happening.
Right - your withdrawn comment is just what I was going for with this change. `ShenandoahFreeSet` maintains its own notion of `used`, which has similar but subtly different rules for the accounting that happens for generations and the heap. Perhaps they could be merged at some point.
> src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp line 409:
>
>> 407: if (req.is_mutator_alloc()) {
>> 408: assert(req.is_young(), "Mutator allocations always come from young generation.");
>> 409: generation->increase_used(size * HeapWordSize);
>
> Where is the generation's use being adjusted now?
Waste, generation/heap used, bytes allocated and the concerns for the pacer are all consolidated into the overloaded `increase_used` method in `ShenandoahHeap`.
-------------
PR Review Comment: https://git.openjdk.org/shenandoah/pull/260#discussion_r1170633795
PR Review Comment: https://git.openjdk.org/shenandoah/pull/260#discussion_r1170634932
PR Review Comment: https://git.openjdk.org/shenandoah/pull/260#discussion_r1170635545
More information about the shenandoah-dev
mailing list