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

8292995: improve the SA page cache #10069

Closed
wants to merge 2 commits into from

Conversation

plummercj
Copy link
Contributor

@plummercj plummercj commented Aug 29, 2022

The page caching support in SA is woefully dated. I think it has stayed the same for over 20 years when it was originally done for solarix-x86. This code has been replicated for every port. Currently all ports only have a 16mb cache. They use 4k pages and there are 4k of them.

I think the 4k page size is fine. The following comment appears in all the ports:

        // ... This is a cache of 4096 4K pages, or 16 MB. The page
        // size must be adjusted to be the hardware's page size.
        // (FIXME: should pick this up from the debugger.)

I disagree with this. Matching the possibly very large hardware page size (I think maybe they meant OS page size) would require the SA page cache to be very very large, using a lot of java heap space. It would also require a lot of unnecessary copying from the debuggee process's memory. There's no reason for the SA cache's page size to match the OS page size.

However, 16mb seems very small. I tried 256mb and this gave about a 10% performance improvement in a heap dump, and is still fairly small, so I think it is a reasonable adjustment.

Another comment you see in all the ports (copied from solaris-x86) is:

        // FIXME: re-test necessity of cache on Linux, where data
        // fetching is faster
        // Cache portion of the remote process's address space.
        // Fetching data over the socket connection to dbx is slow.
        // Might be faster if we were using a binary protocol to talk to
        // dbx, but would have to test. For now, this cache works best
        // if it covers the entire heap of the remote process. FIXME: at

At least on linux the cache is definitely needed. I turned it off and a heap dump took 9x longer. Also I think covering the entire heap is overkill, and I doubt was ever being done given how small the cache is. So I think this comment can just be removed.


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

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10069

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 29, 2022

👋 Welcome back cjplummer! 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 8292995 8292995: improve the SA page cache Aug 29, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Aug 29, 2022
@openjdk
Copy link

openjdk bot commented Aug 29, 2022

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

  • serviceability

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 serviceability serviceability-dev@openjdk.org label Aug 29, 2022
@mlbridge
Copy link

mlbridge bot commented Aug 29, 2022

Webrevs

Copy link
Contributor

@kevinjwalls kevinjwalls 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.
Interesting to see the old comments talking about when it would drive a dbx process and issue commands to inspect memory.

(Based on that I was just checking WindbgDebuggerLocal as that's maybe confusingly named - just noting here that it doesn't drive the "WinDbg" tool exactly, it uses the Debugger Engine from dbgeng.dll (which is good).)

// size must be adjusted to be the hardware's page size.
// (FIXME: should pick this up from the debugger.)
initCache(4096, 4096);
initCache(4096, parseCacheNumPagesProperty(1024 * 64));
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a review. Just a minor comment.
The indent does not match the above lines.
As I see, the indent in the updated files is not unified. There is even indent 3.

Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

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

Nice simplification. Looks good.
Thanks,
Serguei

@openjdk
Copy link

openjdk bot commented Aug 30, 2022

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

8292995: improve the SA page cache

Reviewed-by: kevinw, sspitsyn

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

  • 1cf245d: 8292590: Product JVM crashes with FLAG_SET_XXX on non-product Flag
  • 6335150: 6205692: (spec) javax.crypto.MacSpi.engineUpdate(ByteBuffer input): NPE should be specified
  • 622be79: 8293090: Remove unused par_oop_since_save_marks_iterate_done
  • 3d0ab2b: 8292858: G1: Remove redundant check in G1FlushHumongousCandidateRemSets
  • 6e24827: 8292878: x86: Make scratch register usage explicit in assembler code
  • f5ebbf3: 8292657: Calling GetLocalXXX from virtual thread with thread parameter set to NULL returns carrier locals
  • 550e5d7: 4958071: (spec) confusing exception list for javax.crypto.Cipher.init(...) for
  • d3d2e66: 8293009: Remove unused field 'millisPerHour' in DateFormatSymbols
  • f3ebb42: 8293036: x86_64: Move Continuation-related stub methods to MacroAssembler
  • 1576f99: 8288759: GCC 12 fails to compile signature.cpp due to -Wstringop-overread
  • ... and 13 more: https://git.openjdk.org/jdk/compare/30def49c7286e2a6c2585bc85084b003eec4543a...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 Aug 30, 2022
@plummercj
Copy link
Contributor Author

Thanks Kevin and Serguei!

/integrate

@openjdk
Copy link

openjdk bot commented Aug 30, 2022

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

  • 1cf245d: 8292590: Product JVM crashes with FLAG_SET_XXX on non-product Flag
  • 6335150: 6205692: (spec) javax.crypto.MacSpi.engineUpdate(ByteBuffer input): NPE should be specified
  • 622be79: 8293090: Remove unused par_oop_since_save_marks_iterate_done
  • 3d0ab2b: 8292858: G1: Remove redundant check in G1FlushHumongousCandidateRemSets
  • 6e24827: 8292878: x86: Make scratch register usage explicit in assembler code
  • f5ebbf3: 8292657: Calling GetLocalXXX from virtual thread with thread parameter set to NULL returns carrier locals
  • 550e5d7: 4958071: (spec) confusing exception list for javax.crypto.Cipher.init(...) for
  • d3d2e66: 8293009: Remove unused field 'millisPerHour' in DateFormatSymbols
  • f3ebb42: 8293036: x86_64: Move Continuation-related stub methods to MacroAssembler
  • 1576f99: 8288759: GCC 12 fails to compile signature.cpp due to -Wstringop-overread
  • ... and 13 more: https://git.openjdk.org/jdk/compare/30def49c7286e2a6c2585bc85084b003eec4543a...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Aug 30, 2022

@plummercj Pushed as commit c3380c0.

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

@plummercj plummercj deleted the 8292995_sa_cache branch October 11, 2022 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
3 participants