Skip to content

8357818: Shenandoah doesn't use shared API for printing heap before/after GC #26272

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

Closed
wants to merge 1 commit into from

Conversation

rgithubli
Copy link
Contributor

@rgithubli rgithubli commented Jul 11, 2025

Add logging for Shenandoah as well as Generational Shenandoah.

Log samples:

######################################
Before gc
######################################
[0.231s][debug][gc,heap      ] GC(0) Heap Before GC invocations=0 (full 0):
[0.231s][debug][gc,heap      ] GC(0)  Shenandoah Heap
[0.231s][debug][gc,heap      ] GC(0)   100M max, 100M soft max, 100M committed, 39686K used
[0.231s][debug][gc,heap      ] GC(0)   400 x 256 K regions
[0.231s][debug][gc,heap      ] GC(0)  Status: not cancelled
[0.231s][debug][gc,heap      ] GC(0)  Reserved region:
[0.231s][debug][gc,heap      ] GC(0)   - [0x00000000f9c00000, 0x0000000100000000) 
[0.231s][debug][gc,heap      ] GC(0)  Collection set:
[0.231s][debug][gc,heap      ] GC(0)   - map (vanilla): 0x0000000000004e70
[0.231s][debug][gc,heap      ] GC(0)   - map (biased):  0x0000000000001000
[0.231s][debug][gc,heap      ] GC(0) 
[0.231s][debug][gc,metaspace ] GC(0) Metaspace Before GC invocations=0 (full 0):
[0.231s][debug][gc,metaspace ] GC(0)  Metaspace       used 153K, committed 384K, reserved 1114112K
[0.231s][debug][gc,metaspace ] GC(0)   class space    used 3K, committed 128K, reserved 1048576K




######################################
After gc
######################################
[2.067s][debug][gc,heap        ] GC(11) Heap After GC invocations=0 (full 0):
[2.067s][debug][gc,heap        ] GC(11)  Shenandoah Heap
[2.067s][debug][gc,heap        ] GC(11)   100M max, 100M soft max, 100M committed, 101356K used
[2.067s][debug][gc,heap        ] GC(11)   400 x 256 K regions
[2.067s][debug][gc,heap        ] GC(11)  Status: not cancelled
[2.067s][debug][gc,heap        ] GC(11)  Reserved region:
[2.067s][debug][gc,heap        ] GC(11)   - [0x00000000f9c00000, 0x0000000100000000) 
[2.067s][debug][gc,heap        ] GC(11)  Collection set:
[2.067s][debug][gc,heap        ] GC(11)   - map (vanilla): 0x0000000000004e70
[2.067s][debug][gc,heap        ] GC(11)   - map (biased):  0x0000000000001000
[2.067s][debug][gc,heap        ] GC(11) 
[2.067s][debug][gc,metaspace   ] GC(11) Metaspace After GC invocations=0 (full 0):
[2.067s][debug][gc,metaspace   ] GC(11)  Metaspace       used 190K, committed 384K, reserved 1114112K
[2.067s][debug][gc,metaspace   ] GC(11)   class space    used 4K, committed 128K, reserved 1048576K

Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8357818: Shenandoah doesn't use shared API for printing heap before/after GC (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26272/head:pull/26272
$ git checkout pull/26272

Update a local copy of the PR:
$ git checkout pull/26272
$ git pull https://git.openjdk.org/jdk.git pull/26272/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26272

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26272.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 11, 2025

👋 Welcome back rgithubli! 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 bot commented Jul 11, 2025

@rgithubli 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:

8357818: Shenandoah doesn't use shared API for printing heap before/after GC

Reviewed-by: wkemper, kdnilsen

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 189 new commits pushed to the master branch:

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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@earthling-amzn, @ysramakrishna, @kdnilsen) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk
Copy link

openjdk bot commented Jul 11, 2025

@rgithubli The following labels will be automatically applied to this pull request:

  • hotspot-gc
  • shenandoah

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

@openjdk openjdk bot added hotspot-gc hotspot-gc-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Jul 11, 2025
@rgithubli rgithubli marked this pull request as ready for review July 11, 2025 18:36
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 11, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 11, 2025

Webrevs

Copy link
Contributor

@earthling-amzn earthling-amzn left a comment

Choose a reason for hiding this comment

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

This looks good to me. Someday we should look at combining some of the other related messages (free set status, e.g.) into ShenandoahHeap::print_heap_on.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 11, 2025
@ysramakrishna
Copy link
Member

ysramakrishna commented Jul 11, 2025

[2.067s][debug][gc,heap ] GC(11) Heap After GC invocations=0 (full 0):

Looks like Shenandoah/GenShen are missing increment_total_collections(...), which updates the invocations=... part. I'd roughly expect it to equal the GC id (or be a tad smaller) GC(11).

[2.067s][debug][gc,heap ] GC(11) Shenandoah Heap
[2.067s][debug][gc,heap ] GC(11) 100M max, 100M soft max, 100M committed, 101356K used
[2.067s][debug][gc,heap ] GC(11) 400 x 256 K regions

A potential enhancement for GenShen would be to provide used region counts for old and young separately, and to add the "Generational" prefix in:

[2.067s][debug][gc,heap ] GC(11) Shenandoah Heap

Rest looks good, although I want to verify that we print along all gc cycles, not just concurrent ones, as seems to be the case here.

Copy link
Member

@ysramakrishna ysramakrishna left a comment

Choose a reason for hiding this comment

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

Left some comments in PR. Will complete review by EOD.

@earthling-amzn
Copy link
Contributor

@ysramakrishna , good catch with increment_total_collections. The print_before and print_after calls surround the switch case that handles all GCs (conc, degen, full).

Copy link
Member

@ysramakrishna ysramakrishna left a comment

Choose a reason for hiding this comment

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

Reviewed; looks good, modulo earlier comments for additional information which might be useful for genshen.

Copy link
Contributor

@kdnilsen kdnilsen left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution. I concur with suggestions from @ysramakrishna.

@rgithubli
Copy link
Contributor Author

rgithubli commented Jul 24, 2025

Thanks all. Opened another JBS to fix the missing increment_total_collections in Shenandoah / GenShen, as well as to improve the GenShen logging: https://bugs.openjdk.org/browse/JDK-8364081

Keep this PR as it is and continue integrating this PR.

@rgithubli
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 24, 2025
@openjdk
Copy link

openjdk bot commented Jul 24, 2025

@rgithubli
Your change (at version c333dc0) is now ready to be sponsored by a Committer.

@phohensee
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 24, 2025

Going to push as commit 4e53a9d.
Since your change was applied there have been 189 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 24, 2025
@openjdk openjdk bot closed this Jul 24, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Jul 24, 2025
@openjdk
Copy link

openjdk bot commented Jul 24, 2025

@phohensee @rgithubli Pushed as commit 4e53a9d.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hotspot-gc hotspot-gc-dev@openjdk.org integrated Pull request has been integrated shenandoah shenandoah-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

5 participants