RFR: 8267209: Child threads should defer logging to after child-parent handshake

Thomas Stuefe stuefe at openjdk.java.net
Sat May 22 04:59:08 UTC 2021


On Sun, 16 May 2021 06:57:57 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

> Hi,
> 
> May I have reviews for this very simple change (triggered by this ML discussion [1]):
> 
> On Linux and BSD, we have a handshake between creator thread and newborn thread. Creator thread waits until the newborn is alive and reports back via a monitor handshake.
> 
> The newborn should avoid doing anything unnecessary before reporting back to the creator. But we added logging there, whose performance impact can be anything. We should defer logging to after that handshake.
> 
> I ran OPs [1] test on my machine and with logging to a very fast ssd enabled:
> 
> 
> thomas at starfish:/shared/projects/openjdk$ ./jdk-jdk/output-release/images-stock/jdk/bin/java -Xlog:os+thread:t1.log -cp ./test/repros/repros8/target/repros8-1.0.jar de.stuefe.repros.WaishonTest
> Duration: 5191
> 
> 
> with this patch test time drops by about 19%:
> 
> 
> thomas at starfish:/shared/projects/openjdk$ ./jdk-jdk/output-release/images-stock/jdk/bin/java -Xlog:os+thread:t1.log -cp ./test/repros/repros8/target/repros8-1.0.jar de.stuefe.repros.WaishonTest
> Duration: 4228
> 
> 
> No perceptible difference with logging disabled, as it should be.
> 
> ---
> 
> (Side note: We don't do this handshake on AIX and Windows. Instead, there, we create the thread in suspended state and resume it later. Would be nice to get rid of that handshake for Linux too.)
> 
> [1] https://mail.openjdk.java.net/pipermail/discuss/2021-May/005807.html

Ping?

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

PR: https://git.openjdk.java.net/jdk/pull/4042


More information about the hotspot-runtime-dev mailing list