RFR: 8329203: Parallel: Investigate Mark-Compact for Full GC to decrease memory usage

Roman Kennke rkennke at openjdk.org
Mon May 6 14:54:53 UTC 2024


On Mon, 6 May 2024 10:31:48 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Refactor Parallel full-gc to use the same algorithm (mark-compact) as Serial and G1 full-GC. This removes the obj-end bitmap. When GC threads are few, the old implementation can be more efficient because it requires fewer heap iterations. The new full-GC implementation, on the other hand, is more scalable because it introduces more phases (`forward_to_new_addr` and `adjust_pointers`) that can partition work effectively.
> 
> The diff is rather large, so reading the new code directly from `invoke_no_policy` is probably easier.
> 
> Test: tier1-6; some improvement in Dacapo-h2, CacheStresser, but no difference in specjbb2015, specjvm2008.

The changes look good to me, I only have some minor suggestions.

src/hotspot/share/gc/parallel/psParallelCompact.cpp line 752:

> 750: 
> 751: public:
> 752:   virtual void do_oop(oop* p)                { do_oop_work(p); }

I know that we don't do this very consistently in HotSpot, but the virtual modifier doesn't make much sense here. What *would* make sense is the override keyword.

src/hotspot/share/gc/parallel/psParallelCompact.cpp line 1790:

> 1788:   uint nworkers = ParallelScavengeHeap::heap()->workers().active_workers();
> 1789: 
> 1790:   struct ForwardTask final : public WorkerTask {

At first I found it odd to see a struct here, we use class for this everywhere else. But I guess it's ok.

src/hotspot/share/gc/parallel/psParallelCompact.cpp line 2086:

> 2084: 
> 2085:   // end_addr is inclusive to handle regions starting with dead space.
> 2086:   while(cur_addr <= end_addr) {

Missing space between while and (

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

Changes requested by rkennke (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/19101#pullrequestreview-2040626403
PR Review Comment: https://git.openjdk.org/jdk/pull/19101#discussion_r1590920653
PR Review Comment: https://git.openjdk.org/jdk/pull/19101#discussion_r1590944734
PR Review Comment: https://git.openjdk.org/jdk/pull/19101#discussion_r1590962944


More information about the hotspot-gc-dev mailing list