RFR: Usage tracking cleanup

William Kemper wkemper at openjdk.org
Wed Apr 19 00:24:21 UTC 2023


On Tue, 18 Apr 2023 21:26:31 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 339:
> 
>> 337:       // This is a GCLAB or a TLAB allocation
>> 338:       size_t size = req.size();
>> 339:       size_t free = align_down(r->free() >> LogHeapWordSize, MinObjAlignment);
> 
> Not code that you wrote, but still ...
> 
> Why do we need this alignment downward? It sounds like this would want to be an assertion instead:
> 
> size_t free_words = r->free() >> LogHeapWordSize;
> assert(free_words == align_down(free_words, MinObjAlignment), "Should always be min obj aligned");
> 
> 
> Or may be I am missing something here. In which case a suitable documentation comment would be useful.

Is this just making sure there is enough free space for a minimum sized object?

> src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp line 742:
> 
>> 740:     assert(wasted_bytes == 0 || req.type() == ShenandoahAllocRequest::_alloc_plab, "Only PLABs have waste");
>> 741:     generation->increase_used(actual_bytes + wasted_bytes);
>> 742:     increase_used(actual_bytes + wasted_bytes);
> 
> So here, waste is included into used for both heap & generation.

Yes, but waste is only non-zero for PLABs because only PLABs have their "waste" _in front of_ the usable parts of the LAB.

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

PR Review Comment: https://git.openjdk.org/shenandoah/pull/260#discussion_r1170684053
PR Review Comment: https://git.openjdk.org/shenandoah/pull/260#discussion_r1170684941


More information about the shenandoah-dev mailing list