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

8314629: Generational ZGC: Clearing All SoftReferences log line lacks GCId #17196

Closed
wants to merge 4 commits into from

Conversation

lgxbslgx
Copy link
Member

@lgxbslgx lgxbslgx commented Dec 28, 2023

Hi all,

This patch adds the GCId to the log of soft reference policy. I move the related code to the start of the old generational GC which needs to add a parameter ZDriverRequest in the method ZDriverMajor::collect_old. An alternative, which doesn't need to add a parameter, is only moving the related code to the start of the major GC, concretely the method ZDriverMajor::gc. But considering the references only be cleared in old generational GC, I make such decision. Waiting for your opinion on it.

Thanks for taking the time to review.

Best Regards,
-- Guoxiong


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-8314629: Generational ZGC: Clearing All SoftReferences log line lacks GCId (Bug - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17196

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 28, 2023

👋 Welcome back gli! 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 JDK-8314629 8314629: Generational ZGC: Clearing All SoftReferences log line lacks GCId Dec 28, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 28, 2023
@openjdk
Copy link

openjdk bot commented Dec 28, 2023

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

  • hotspot-gc

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-gc hotspot-gc-dev@openjdk.org label Dec 28, 2023
@mlbridge
Copy link

mlbridge bot commented Dec 28, 2023

Webrevs

Copy link
Contributor

@fisk fisk left a comment

Choose a reason for hiding this comment

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

This makes me a bit nervous. I think this introduces behavioural changes and not just logging changes. By moving the decision making of whether to clear soft references or not past the mark start pause that bumps the sequence number of the two generations, I think you are subtly introducing a race condition that can yield premature OOM issues. If you want to change the logging here, I think we need to find a different way. Perhaps decouple the decision making and logging so we can log wherever we want to without changing the behaviour.

@lgxbslgx
Copy link
Member Author

This makes me a bit nervous. I think this introduces behavioural changes and not just logging changes. By moving the decision making of whether to clear soft references or not past the mark start pause that bumps the sequence number of the two generations, I think you are subtly introducing a race condition that can yield premature OOM issues. If you want to change the logging here, I think we need to find a different way. Perhaps decouple the decision making and logging so we can log wherever we want to without changing the behaviour.

@fisk I missed that the young GC also uses such info to discover references (but only the old generation processes references ). Thanks for reminding me.

What about moving the related code to the start of the method ZDriverMajor::gc? The alternative I mentioned.
It means that the tag O, shown below, will not be outputted.

[4781.774s][info][gc,ref] GC(1239) O: Clearing All SoftReferences

@fisk
Copy link
Contributor

fisk commented Dec 28, 2023

This makes me a bit nervous. I think this introduces behavioural changes and not just logging changes. By moving the decision making of whether to clear soft references or not past the mark start pause that bumps the sequence number of the two generations, I think you are subtly introducing a race condition that can yield premature OOM issues. If you want to change the logging here, I think we need to find a different way. Perhaps decouple the decision making and logging so we can log wherever we want to without changing the behaviour.

@fisk I missed that the young GC also uses such info to discover references (but only the old generation processes references ). Thanks for reminding me.

What about moving the related code to the start of the method ZDriverMajor::gc? The alternative I mentioned.

It means that the tag O, shown below, will not be outputted.


[4781.774s][info][gc,ref] GC(1239) O: Clearing All SoftReferences

I think I would prefer if the function that sets the soft ref policy just didn't log anything, and we put the logging statement separately where we want it instead. That way I think we can get the log we want without having to change the behaviour. What do you think?

@lgxbslgx
Copy link
Member Author

I think I would prefer if the function that sets the soft ref policy just didn't log anything, and we put the logging statement separately where we want it instead. That way I think we can get the log we want without having to change the behaviour. What do you think?

If we don't log in the method ZReferenceProcessor::set_soft_reference_policy and delay the log to a later stage, such as refenrence processing stage, it is hard to get the information about whether we should clear all the soft references. What we can do is judge whether the field ZReferenceProcessor::_soft_reference_policy is AlwaysClearPolicy or not. Such judgement looks much like RTTI [1] which is disabled in hotspot. In order to obey the dev rule, we can add a virtual method, may named kind, to the class ReferencePolicy and its subclasses which can avoid RTTI and can judge their types (just like the method CollectedHeap::kind). Is my understanding right? If so, it seems not worth to add such method only in order to output one line log.

[1] https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md#rtti-runtime-type-information

@fisk
Copy link
Contributor

fisk commented Dec 29, 2023

I guess you could add a bool member variable to the reference processor to remember the choice.

@lgxbslgx
Copy link
Member Author

lgxbslgx commented Jan 1, 2024

I guess you could add a bool member variable to the reference processor to remember the choice.

Thanks for your guide. I updated the code just now.

Copy link
Contributor

@fisk fisk left a comment

Choose a reason for hiding this comment

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

Maybe some small changes...

src/hotspot/share/gc/z/zReferenceProcessor.cpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/z/zReferenceProcessor.hpp Outdated Show resolved Hide resolved
src/hotspot/share/gc/z/zReferenceProcessor.hpp Outdated Show resolved Hide resolved
Copy link
Contributor

@fisk fisk left a comment

Choose a reason for hiding this comment

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

Looks good.

@openjdk
Copy link

openjdk bot commented Jan 2, 2024

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

8314629: Generational ZGC: Clearing All SoftReferences log line lacks GCId

Reviewed-by: eosterlund, tschatzl

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

  • 37a6172: 8322936: Update blessed-modifier-order.sh for default, sealed, and non-sealed
  • 7d42aa1: 8310277: jdk/javadoc/doclet/testMethodCommentAlgorithm/TestMethodCommentsAlgorithm.java fails with IllegalStateException
  • 6e9671a: 8323264: Serial: Remove unused GenerationBlockSizeClosure
  • 52a6c37: 8322858: compiler/c2/aarch64/TestFarJump.java fails on AArch64 due to unexpected PrintAssembly output
  • 075fed9: 8323241: jcmd manpage should use lists for argument lists
  • 30f93a2: 8320069: RISC-V: Add Zcb instructions
  • 4cf131a: 8319716: RISC-V: Add SHA-2
  • 7286f52: 8322829: Refactor nioBlocker to avoid blocking while holding Thread's interrupt lock
  • 07fce8e: 8320864: Serial: Extract out Full GC related fields from ContiguousSpace
  • 176606d: 8310995: missing @SInCE tags in 36 jdk.dynalink classes
  • ... and 99 more: https://git.openjdk.org/jdk/compare/2a59243cbaf3e7d5d1bfc9f247d28bc648687ea5...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 Pull request is ready to be integrated label Jan 2, 2024
@lgxbslgx
Copy link
Member Author

lgxbslgx commented Jan 5, 2024

Waiting for another review.

@lgxbslgx
Copy link
Member Author

@fisk @tschatzl Thanks for your reviews. Integrating.

/integrate

@openjdk
Copy link

openjdk bot commented Jan 10, 2024

Going to push as commit 88dafe5.
Since your change was applied there have been 128 commits pushed to the master branch:

  • 8d94799: 8322828: Parallel: Rename ParallelCompactData::_region_start
  • 9847086: 8323499: Remove unused methods in space.hpp
  • 4086176: 8322987: Remove gc/stress/gclocker/TestGCLocker* since they always fail with OOME
  • 88378ed: 8277869: Maven POMs are using HTTP links where HTTPS is available
  • 8569227: 8322589: Add Ideal transformation: (~a) & (~b) => ~(a | b)
  • f4ca41a: 8322816: RISC-V: Incorrect guarantee in patch_vtype
  • 376051a: 8320919: Clarify Locale related system properties
  • a5071e0: 8322817: RISC-V: Eliminate -Wparentheses warnings in riscv code
  • 28d8149: 8323115: x86-32: Incorrect predicates for cmov instruct transforms with UseSSE
  • e9f7db3: 8322880: Eliminate -Wparentheses warnings in arm32 code
  • ... and 118 more: https://git.openjdk.org/jdk/compare/2a59243cbaf3e7d5d1bfc9f247d28bc648687ea5...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 10, 2024
@openjdk openjdk bot closed this Jan 10, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jan 10, 2024
@openjdk
Copy link

openjdk bot commented Jan 10, 2024

@lgxbslgx Pushed as commit 88dafe5.

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

@lgxbslgx lgxbslgx deleted the 8314629-LACK-GCID branch January 10, 2024 12:20
@mmyxym
Copy link

mmyxym commented Feb 20, 2024

/backport jdk21u-dev

@openjdk
Copy link

openjdk bot commented Feb 20, 2024

@mmyxym the backport was successfully created on the branch backport-mmyxym-88dafe56 in my personal fork of openjdk/jdk21u-dev. To create a pull request with this backport targeting openjdk/jdk21u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 88dafe56 from the openjdk/jdk repository.

The commit being backported was authored by Guoxiong Li on 10 Jan 2024 and was reviewed by Erik Österlund and Thomas Schatzl.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk21u-dev:

$ git fetch https://github.com/openjdk-bots/jdk21u-dev.git backport-mmyxym-88dafe56:backport-mmyxym-88dafe56
$ git checkout backport-mmyxym-88dafe56
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u-dev.git backport-mmyxym-88dafe56

⚠️ @mmyxym You are not yet a collaborator in my fork openjdk-bots/jdk21u-dev. An invite will be sent out and you need to accept it before you can proceed.

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
4 participants