RFR: 8294845: Make globals accessed by G1 young gen revising atomic

Kim Barrett kbarrett at openjdk.org
Wed Nov 2 06:55:44 UTC 2022


On Tue, 25 Oct 2022 07:57:15 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> Hi all,
> 
>   can I have reviews for this cleanup that makes a few globals accessed by `G1Policy::update_young_length_bounds` "atomic" as per style guide? Basically there are a few variables that are changed by young gen size revising that are read concurrently, and to indicate that, this change decorates them with the `Atomic` accessor functions.
> 
> This is no attempt to fix any visibility races that (already, pre-existing) occur when these values are written and read; I think all of these are benign and can at most lead to having garbage collections that are "too late" or "too early" due to that. However all the young gen length revising, particularly in presence of the gclocker, is and has always been a best effort approach as far as I could ever tell.
> 
> Testing: gha
> 
> Thanks,
>   Thomas

Looks good.

src/hotspot/share/gc/g1/g1Policy.cpp line 1137:

> 1135:   if (GCLockerEdenExpansionPercent > 0) {
> 1136:     double perc = (double) GCLockerEdenExpansionPercent / 100.0;
> 1137:     double expansion_region_num_d = perc * (double)young_list_target_length();

pre-existing: Casts to double in these two lines is just clutter.

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

Marked as reviewed by kbarrett (Reviewer).

PR: https://git.openjdk.org/jdk/pull/10845


More information about the hotspot-gc-dev mailing list