RFR: 8259776: Remove ParallelGC non-CAS oldgen allocation [v2]
Thomas Schatzl
tschatzl at openjdk.java.net
Mon Jan 18 10:23:49 UTC 2021
On Sat, 16 Jan 2021 11:59:30 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> Please review this change to ParallelGC oldgen allocation. There were two
>> variants, one using CAS on the _top member of the mutable space, the other
>> requiring locking or other forms of mutual exclusion.
>>
>> We don't need both variants. The non-CAS variant is only used in a few
>> places, where the cost of an extra CAS doesn't matter. What does matter is
>> that having two variants, which must not be used concurrently, makes the
>> code larger, more complex, and harder to verify. (This change came out of
>> analyzing JDK-8259271. No problems were found (or expected), so this change
>> is not expected to impact that bug. But because of the two variants, the
>> possibility of unexpected interact needed to be examined.)
>>
>> The non-CAS allocation support has been removed, with PSOldGen::allocate now
>> implemented using the CAS-based allocation. The cas_ prefix naming
>> convention is retained for the internals for clarity.
>>
>> While looking at this, noticed and removed a couple of lingering references
>> to the class AdjoiningGenerations, which no longer exists after JDK-8243146.
>>
>> Testing:
>> mach5 tier1-5
>
> Kim Barrett has updated the pull request incrementally with one additional commit since the last revision:
>
> record oldgen mutator allocations in size policy
Marked as reviewed by tschatzl (Reviewer).
src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp line 404:
> 402: if (!should_alloc_in_eden(size) || GCLocker::is_active_and_needs_gc()) {
> 403: // Size is too big for eden, or gc is locked out.
> 404: return old_gen()->allocate_and_record(size);
I would have kind of preferred if `allocate_and_record` were a helper method here in `ParallelScavengeHeap` since the recording seems to be entirely a thing of the PSH and not of the old gen, and the implementation of that method just calls back in here, but I am good with this too.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2101
More information about the hotspot-gc-dev
mailing list