Skip to content

Conversation

@zhengyu123
Copy link
Contributor

@zhengyu123 zhengyu123 commented Oct 6, 2023

Interpreter oop maps are computed lazily during GC root scan and they are expensive to compute.

GCs uses a small hash table per instance class to cache computed oop maps during STW root scan, but not for concurrent root scan.

This patch is intended to enable OopMapCache for concurrent GCs.

Test:
tier1 and tier2 fastdebug and release on MacOSX, Linux 86_84 and Linux 86_32.


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-8317466: Enable interpreter oopMapCache for concurrent GCs (Enhancement - P4)

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 16074

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 6, 2023

👋 Welcome back zgu! 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 added the rfr Pull request is ready for review label Oct 6, 2023
@openjdk
Copy link

openjdk bot commented Oct 6, 2023

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

  • hotspot
  • 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 hotspot-dev@openjdk.org shenandoah shenandoah-dev@openjdk.org labels Oct 6, 2023
@zhengyu123
Copy link
Contributor Author

/cc add hotspot-runtime
/cc add hotspot-gc

@openjdk openjdk bot added the hotspot-runtime hotspot-runtime-dev@openjdk.org label Oct 6, 2023
@openjdk
Copy link

openjdk bot commented Oct 6, 2023

@zhengyu123
The hotspot-runtime label was successfully added.

@openjdk openjdk bot added the hotspot-gc hotspot-gc-dev@openjdk.org label Oct 6, 2023
@openjdk
Copy link

openjdk bot commented Oct 6, 2023

@zhengyu123
The hotspot-gc label was successfully added.

@mlbridge
Copy link

mlbridge bot commented Oct 6, 2023

Webrevs

Copy link

@leelamv leelamv left a comment

Choose a reason for hiding this comment

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

Before of this change, VM_Operations which enabled "is_gc_active" and walks stack to collect roots had a call to OopMapCache::cleanup_old_entries() in its corresponding doit_epilogue(). This is to free the old entries which are collected during safepoint.

Now scope of the change isn't clear.

We seem to extend them to concurrent GCs during their concurrent phases (Not just safepoints of concurrent GCs). Calling OopMapCache::cleanup_old_entries() in doit_epilogue() would effectively cleanup old entries accumulated during concurrent phase of the GC and also during safepoint.

But change also allows java threads to accumulate old entries. When/Who calls cleanup_old_entries() in this case ? These needs to wait until future GC which does cleanup in doit_epilogue(). However, at least theoretically, we can have large time windows without GCs. Old entries accumulated by java threads can be seen as a leak (until next GC)

A separate thought to make change simpler. Can cleanup_old_entries become a list of Cleanup tasks VM thread does during cleanup phase.

@zhengyu123
Copy link
Contributor Author

zhengyu123 commented Oct 23, 2023

Before of this change, VM_Operations which enabled "is_gc_active" and walks stack to collect roots had a call to OopMapCache::cleanup_old_entries() in its corresponding doit_epilogue(). This is to free the old entries which are collected during safepoint.

Now scope of the change isn't clear.

We seem to extend them to concurrent GCs during their concurrent phases (Not just safepoints of concurrent GCs). Calling OopMapCache::cleanup_old_entries() in doit_epilogue() would effectively cleanup old entries accumulated during concurrent phase of the GC and also during safepoint.

But change also allows java threads to accumulate old entries. When/Who calls cleanup_old_entries() in this case ? These needs to wait until future GC which does cleanup in doit_epilogue(). However, at least theoretically, we can have large time windows without GCs. Old entries accumulated by java threads can be seen as a leak (until next GC)

Yes, it could accumulate a few. But from what I saw, there are not many. They are cleanup by:

  • Serial, Parallel and G1: any VM_GC_Operations
  • ZGC: any VM_ZOperations
  • Shenandoah: I should have added OopMapCache::cleanup_old_entries() in VM_ShenandoahOperation, where should help jdk11u backport.

A separate thought to make change simpler. Can cleanup_old_entries become a list of Cleanup tasks VM thread does during cleanup phase.

No. There is no point to add safepoint latency when it can be done outside of safepoint.

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 22, 2023

@zhengyu123 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!

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 20, 2023

@zhengyu123 This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot hotspot-dev@openjdk.org hotspot-gc hotspot-gc-dev@openjdk.org hotspot-runtime hotspot-runtime-dev@openjdk.org rfr Pull request is ready for review shenandoah shenandoah-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

2 participants