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

8263387: G1GarbageCollection JFR event gets gc phase, not gc type #2960

Closed
wants to merge 6 commits into from

Conversation

tschatzl
Copy link
Contributor

@tschatzl tschatzl commented Mar 12, 2021

Hi all,

can I get reviews for this change that fixes some mess-up with JFR events, where the "G1YoungCollection" event should give the name of the current (G1) garbage collection. Currently the code adds a new type that returns the GC phase similar to shown in the tuning guide in Fig 7-2. Which might not be as expected, but due to when it's called, the user strings are the usual "Normal" / "Mixed" / "Concurrent Start" that are well-known for pauses.

It also showed that the phase enum we carry around internally has only been used for this purpose, so it can be deleted. While at it, the JFR event can now show the "new" pauses ("Prepare Mixed" and the "Concurrent Start" variants).

There are three commits in this series:

  • Initial commit: implements the changes in the current coding style
  • Rename file: I renamed g1GCTypes.hpp to the now more fitting g1GCPauseType.hpp
  • enum class changes: where I attempted to turn the C enum G1GCPauseTypes into an enum class to make things a bit more c++'y. Not sure if it is a good change, it does not give a lot (apart from less polluting the global namespace a bit), but I left it here to see the opinions of others.

Testing: tier1-5, checked some JFR recordings for the event and its description

Thanks,
Thomas


Progress

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

Issue

  • JDK-8263387: G1GarbageCollection JFR event gets gc phase, not gc type

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2960/head:pull/2960
$ git checkout pull/2960

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Mar 12, 2021

👋 Welcome back tschatzl! 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
Copy link

@openjdk openjdk bot commented Mar 12, 2021

@tschatzl The following label will be automatically applied to this pull request:

  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the hotspot label Mar 12, 2021
@tschatzl tschatzl force-pushed the 8263387-gc-pause-changes branch from 199f2b6 to 7dfe745 Compare Mar 12, 2021
@tschatzl tschatzl force-pushed the 8263387-gc-pause-changes branch from 7dfe745 to 9b74441 Compare Mar 12, 2021
@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Mar 12, 2021

/label delete hotspot
/label add hotspot-gc jfr

@openjdk
Copy link

@openjdk openjdk bot commented Mar 12, 2021

@tschatzl The label delete is not a valid label. These labels are valid:

  • serviceability
  • hotspot
  • sound
  • hotspot-compiler
  • kulla
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • 2d
  • security
  • swing
  • hotspot-runtime
  • jmx
  • build
  • nio
  • beans
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr
  • awt

@openjdk
Copy link

@openjdk openjdk bot commented Mar 12, 2021

@tschatzl The label jfr is not a valid label. These labels are valid:

  • serviceability
  • hotspot
  • sound
  • hotspot-compiler
  • kulla
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • 2d
  • security
  • swing
  • hotspot-runtime
  • jmx
  • build
  • nio
  • beans
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr
  • awt

@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Mar 12, 2021

/label remove hotspot

@openjdk openjdk bot removed the hotspot label Mar 12, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 12, 2021

@tschatzl
The hotspot label was successfully removed.

@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Mar 12, 2021

/label add hotspot-gc

@openjdk openjdk bot added the hotspot-gc label Mar 12, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 12, 2021

@tschatzl
The hotspot-gc label was successfully added.

@tschatzl tschatzl marked this pull request as ready for review Mar 12, 2021
@openjdk openjdk bot added the rfr label Mar 12, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Mar 12, 2021

Webrevs


void initialize();
void report_yc_phase(G1GCYoungPhase phase);
void report_yc_pause(G1GCPauseType pause);
Copy link
Member

@walulyai walulyai Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename report_yc_pause to match GCPauseType

Copy link
Contributor

@kstefanj kstefanj Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, something like report_yc_type() or since this is the G1NewTracer just report_gc_type()

Copy link
Contributor

@kstefanj kstefanj left a comment

Looks good, just a few small comments that you can do with as you like :)

};

class G1YCTypeConstant : public JfrSerializer {
public:
void serialize(JfrCheckpointWriter& writer) {
static const u4 nof_entries = G1GCYoungPhaseEndSentinel;
static const u4 nof_entries = static_cast<u4>(EnumRange<G1GCPauseType>{}.size());
Copy link
Contributor

@kstefanj kstefanj Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid creating the EnumRangetwice you could do:

constexpr EnumRange<G1GCPauseType> types{};
static const u4 nof_entries = static_cast<u4>(types.size());

And then use types in the for-loop below as well.


void initialize();
void report_yc_phase(G1GCYoungPhase phase);
void report_yc_pause(G1GCPauseType pause);
Copy link
Contributor

@kstefanj kstefanj Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, something like report_yc_type() or since this is the G1NewTracer just report_gc_type()

void G1NewTracer::report_yc_phase(G1GCYoungPhase phase) {
_g1_young_gc_info.set_phase(phase);
void G1NewTracer::report_yc_pause(G1GCPauseType pause) {
_pause = pause;
Copy link
Contributor

@kstefanj kstefanj Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe call G1GCPauseTypeHelper::assert_is_young_pause(pause)here.

@openjdk
Copy link

@openjdk openjdk bot commented Mar 15, 2021

@tschatzl This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8263387: G1GarbageCollection JFR event gets gc phase, not gc type

Reviewed-by: sjohanss, ayang, iwalulya

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 44 new commits pushed to the master branch:

  • c0176c4: 8263552: Use String.valueOf() for char-to-String conversions
  • fac39fe: 8263508: Remove dead code in MethodHandleImpl
  • 7b4aefe: 8263530: sun.awt.X11.ListHelper.removeAll() should use clear()
  • 32c7fcc: 8263490: [macos] Crash occurs on JPasswordField with activated InputMethod
  • 8afec70: 8260931: Implement JEP 382: New macOS Rendering Pipeline
  • 0638303: 8263497: Clean up sun.security.krb5.PrincipalName::toByteArray
  • ba22e6f: 8263446: Avoid unary minus over unsigned type in ObjectSynchronizer::dec_in_use_list_ceiling
  • b371f90: 8263504: Some OutputMachOpcodes fields are uninitialized
  • f7e0a09: 8263425: AArch64: two potential bugs in C1 LIRGenerator::generate_address()
  • 554dd29: 8263564: Consolidate POSIX code for runtime exit support: os::shutdown, os::abort and os::die
  • ... and 34 more: https://git.openjdk.java.net/jdk/compare/a9b4f033ddfb2e7ea36ecdf2f076fc374fe54cac...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Mar 15, 2021
"Remark",
"Mixed",
"Full",
"Invalid"};
Copy link
Member

@albertnetymk albertnetymk Mar 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pause_strings[] should not include "Invalid" any more, right?

@tschatzl
Copy link
Contributor Author

@tschatzl tschatzl commented Mar 15, 2021

/integrate

@openjdk openjdk bot closed this Mar 15, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Mar 15, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 15, 2021

@tschatzl Since your change was applied there have been 51 commits pushed to the master branch:

  • 5ab5244: 8263514: Minor issue in JavacFileManager.SortFiles.REVERSE
  • 771b146: 8245025: MoveAndUpdateClosure::do_addr calls function with side-effects in an assert
  • 46d78f0: 6539707: (fc) MappedByteBuffer.force() method throws an IOException in a very simple test
  • 189289d: 8262326: MaxMetaspaceSize does not have to be aligned to metaspace commit alignment
  • d825198: 8263556: remove @modules java.base from tests
  • d6b5e18: 8263191: Consolidate ThreadInVMfromJavaNoAsyncException and ThreadBlockInVMWithDeadlockCheck with existing wrappers
  • 80cdf78: 8263544: Unused argument in ConstantPoolCacheEntry::set_field()
  • c0176c4: 8263552: Use String.valueOf() for char-to-String conversions
  • fac39fe: 8263508: Remove dead code in MethodHandleImpl
  • 7b4aefe: 8263530: sun.awt.X11.ListHelper.removeAll() should use clear()
  • ... and 41 more: https://git.openjdk.java.net/jdk/compare/a9b4f033ddfb2e7ea36ecdf2f076fc374fe54cac...master

Your commit was automatically rebased without conflicts.

Pushed as commit 4f1cda4.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@tschatzl tschatzl deleted the 8263387-gc-pause-changes branch Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc integrated
4 participants