RFR: 8365880: Shenandoah: Unify memory usage accounting in ShenandoahFreeSet [v14]

Kelvin Nilsen kdnilsen at openjdk.org
Fri Oct 3 22:07:53 UTC 2025


On Fri, 3 Oct 2025 20:09:30 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

>> This PR eliminates redundant bookkeeping that had been carried out by both ShenandoahGeneration and ShenandoahFreeSet.  In the new code, we keep a single tally of relevant information within ShenandoahFreeSet.
>> Queries serviced by ShenandoahGeneration are now delegated to ShenandoahFreeSet.
>> 
>> This change eliminates rare and troublesome assertion failures that were often raised when the ShenandoahFreeSet tallies did not match the ShenandoahGeneration tallies.  These assertion failures resulted because the two sets of books are updated at different times, using different synchronization mechanisms.
>> 
>> The other benefit of this change is that we have less synchronization overhead because we only have to maintain a single set of books.
>
> Kelvin Nilsen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   simplify implementation of promote_in_place

src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp line 136:

> 134: 
> 135: #ifndef PRODUCT
> 136:   void dump_bitmap_row(idx_t region_idx) const;

maybe revert this.  bitmap rows are not idx_t.

src/hotspot/share/gc/shenandoah/shenandoahGeneration.hpp line 71:

> 69:   // Usage
> 70: 
> 71:   volatile size_t _used;

Get rid of this.  no longer needed.  (search for volatile, most should go.)

do we need _max_capacity?  probably not.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26867#discussion_r2403455453
PR Review Comment: https://git.openjdk.org/jdk/pull/26867#discussion_r2403449921


More information about the hotspot-gc-dev mailing list