[jdk21u-dev] RFR: 8319876: Reduce memory consumption of VM_ThreadDump::doit

Long Yang lyang at openjdk.org
Wed Apr 3 01:31:12 UTC 2024


On Fri, 1 Mar 2024 08:16:11 GMT, Long Yang <lyang at openjdk.org> wrote:

> Hi, all
> 
> Could I have a review of this backport.
> 
> This pull request contains a backport of commit [8ec6b8de3bb3d7aeebdcb45d761b18cce3bab75e](https://github.com/openjdk/jdk/commit/8ec6b8de3bb3d7aeebdcb45d761b18cce3bab75e) from the [openjdk/jdk](https://github.com/openjdk/jdk) repository.
> This backport can significantly reduce the `RSS` during the execution of `ThreadMXBean.dumpAllThreads(boolean, boolean)`.
> 
> On `jdk21u-dev`, if creates 4096 threads, and the stack depth of each thread is 256.
> On the version that does not contain this backport, during the execution of `ThreadMXBean.dumpAllThreads(true, true)`, the `RSS` reaches about 5GiB.
> On the version that contains this backport, the max `RSS` is about 300MiB.
> 
> There is a difference between `jdk21u-dev` and `openjdk/jdk`. 
> On `openjdk/jdk`, `ThreadStackTrace::dump_stack_at_safepoint` will only be executed in `VMThread`.
> But on `jdk21u-dev`, `ThreadStackTrace::dump_stack_at_safepoint` will be executed in `VMThread` or `RuntimeWorker`, so when creating `ResourceMark`, can not directedly specify `VMThread` like what `openjdk/jdk` does, but needs to read current thread.
> 
> Testing: 
> I ran `tier1`, `tier2`, `tier3`, `tier4` on my host machine with the `jdk21u-dev` including this backport.
> `tier1`, `tier2`, and `tier3` all passed.
> Because my host does not have a `display device`, I added `export JTREG_KEYWORDS="!headful"` before running `tier4`.
> Finally, some tests in `tier4` that depend on the printing device failed, and the rest were successful.
> 
> The [GHA](https://github.com/yanglong1010/jdk21u-dev/actions/runs/8093195914/job/22116320956) failed in [linux-cross-compile, build(riscv64), Create sysroot].
> I've also seen others fail at this step as well (e.g. [link](https://github.com/openjdk-bots/jdk21u-dev/actions/runs/8077954001/job/22081472372)), it looks like there's an issue with the GHA's process.
> 
> I would appreciate it if anyone could review this.
> 
> Thanks!

Thank you all !

-------------

PR Comment: https://git.openjdk.org/jdk21u-dev/pull/307#issuecomment-2033377839


More information about the jdk-updates-dev mailing list