RFR: 8259776: Remove ParallelGC non-CAS oldgen allocation

Thomas Schatzl tschatzl at openjdk.java.net
Fri Jan 15 15:09:03 UTC 2021


On Fri, 15 Jan 2021 14:16:50 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

Changes requested by tschatzl (Reviewer).

src/hotspot/share/gc/parallel/psOldGen.hpp line 137:

> 135:   void resize(size_t desired_free_space);
> 136: 
> 137:   HeapWord* allocate(size_t word_size) {

Before this change there has been a small semantical difference between `allocate()` and `par_allocate()`. The former also updated the size policy, which seem to be missing now in `ParallelScavengeHeap::mem_allocate_old_gen()` and `ParallelScavengeHeap::failed_mem_allocate()`.

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

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



More information about the hotspot-gc-dev mailing list