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

Thomas Stuefe stuefe at openjdk.java.net
Tue Jun 8 04:00:22 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

This pull request has now been integrated.

Changeset: f40c89e8
Author:    Thomas Stuefe <stuefe at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/f40c89e8e9fae26da53b5d820d8e64d9b30faf8c
Stats:     12 lines in 2 files changed: 6 ins; 6 del; 0 mod

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

Reviewed-by: dholmes, coleenp

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

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


More information about the hotspot-runtime-dev mailing list