Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8250597: G1: Improve inlining around trim_queue #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

@dchuyko
Copy link
Member

@dchuyko dchuyko commented Jun 11, 2021

This change improves latency with G1 in some cases and makes trim_queue() code structure closer to current mainline.

The original patch does not apply cleanly in particular because of https://bugs.openjdk.java.net/browse/JDK-8200545 . However the refactoring is rather simple because it is a rearrangement of code between functions with compiler hints. It has been reproduced (short description in the next comment).

The change is isolated and is a set of code moves so the risk is low.

Testing: tier1, tier2 on aarch64 and x86_64 in development, the change has been included in Liberica JDK 11u EA for some time.

As an example of performance improvement, Critical-jOPS on Graviton2 raised +1%:+6.2% for 8GB heap.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk11u-dev pull/26/head:pull/26
$ git checkout pull/26

Update a local copy of the PR:
$ git checkout pull/26
$ git pull https://git.openjdk.java.net/jdk11u-dev pull/26/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26

View PR using the GUI difftool:
$ git pr show -t 26

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk11u-dev/pull/26.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Jun 11, 2021

👋 Welcome back dchuyko! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title Backport e648a907b31fd0d6b746d149fda2a8d5fbe26dc0 8250597: G1: Improve inlining around trim_queue Jun 11, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Jun 11, 2021

This backport pull request has now been updated with issue and summary from the original commit.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Jun 11, 2021

Webrevs

@dchuyko
Copy link
Member Author

@dchuyko dchuyko commented Jun 11, 2021

G1ParScanThreadState::trim_queue():
Moved from g1ParScanThreadState.cpp to g1ParScanThreadState.inline.hpp, 'do-while !is_empty()' eleiminated.

G1ParScanThreadState::do_oop_evac():
Moved from g1ParScanThreadState.inline.hpp to g1ParScanThreadState.cpp, copy_to_survivor_space() -> do_copy_to_survivor_space()

[G1ParScanThreadState::do_partial_array()]
G1ParScanThreadState::do_oop_partial_array():
Moved from g1ParScanThreadState.inline.hpp to g1ParScanThreadState.cpp, made not 'inline'.

[G1ParScanThreadState::dispatch_task()]
G1ParScanThreadState::dispatch_reference():
Moved from g1ParScanThreadState.inline.hpp to g1ParScanThreadState.cpp, made not 'inline'.

G1ParScanThreadState::needs_partial_trimming():
Made not 'inline' in g1ParScanThreadState.inline.hpp.

G1ParScanThreadState::trim_queue_to_threshold()
Declaration moved from g1ParScanThreadState.inline.hpp to g1ParScanThreadState.cpp, 'inline' changed to 'ATTRIBUTE_FLATTEN NOINLINE' in g1ParScanThreadState.cpp, got 'do-while !overflow_empty()', made not 'inline' in g1ParScanThreadState.hpp.

G1ParScanThreadState::steal_and_trim_queue():
Declaration moved from g1ParScanThreadState.inline.hpp to g1ParScanThreadState.cpp, with 'ATTRIBUTE_FLATTEN', comments, made not 'inline' in g1ParScanThreadState.hpp.

G1ParScanThreadState::allocate_copy_slow():
Added in g1ParScanThread_surviving_young_words[young_index] += word_szState.cpp as 'NOINLINE', extracted from copy_to_survivor_space/if (obj_ptr == NULL) except the case when handle_evacuation_failure_par() is needed, part before tracer is wrapped in if (!(dest_attr->is_old() && _old_gen_is_full)), tracing is wrapped in if (obj_ptr != NULL), declaration added in g1ParScanThreadState.hpp.

G1ParScanThreadState::undo_allocation():
Added in g1ParScanThreadState.cpp as 'NOINLINE', extracted from copy_to_survivor_space/_plab_allocator->undo_allocation, declaration added in g1ParScanThreadState.hpp.

G1ParScanThreadState::copy_to_survivor_space():
Renamed to do_copy_to_survivor_space() in g1ParScanThreadState.cpp + comment, copy_to_survivor_space() added as a wrapper in g1ParScanThreadState.cpp, do_copy_to_survivor_space() declaration added and copy_to_survivor_space() declaration corrected in g1ParScanThreadState.hpp.
assert(is_in_cset()) has been added.
if(_old_gen_is_full && dest_state.is_old()) block moved.
_surviving_young_words[young_index] += word_sz moved into new block around young_index > 0 asserts

G1ParScanThreadState::handle_evacuation_failure_par():
'NOINLINE' in g1ParScanThreadState.cpp.

G1ParScanThreadState::is_partially_trimmed():
Manually inlined into trim_queue_partially().

G1ParScanThreadState::trim_queue_partially():
'inline' in g1ParScanThreadState.hpp instead of g1ParScanThreadState.inline.hpp.
do-while moved (in the patch it is replaced by asserts).

G1ParScanThreadState::trim_queue():
Made 'inline' in g1ParScanThreadState.hpp.

ATTRIBUTE_FLATTEN
Defined in globalDefinitions.hpp, globalDefinitions_gcc.hpp.

Manually inline deal_with_reference()-s into G1ParScanThreadState::dispatch_reference().

@mlbridge
Copy link

@mlbridge mlbridge bot commented Jun 17, 2021

Mailing list message from Dmitry Chuyko on jdk-updates-dev:

CC'ing hotspot-gc-dev.

On 6/11/21 5:08 PM, Dmitry Chuyko wrote:

1 similar comment
@mlbridge
Copy link

@mlbridge mlbridge bot commented Jun 17, 2021

Mailing list message from Dmitry Chuyko on jdk-updates-dev:

CC'ing hotspot-gc-dev.

On 6/11/21 5:08 PM, Dmitry Chuyko wrote:

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Oct 13, 2021

@dchuyko This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
1 participant