RFR: 8303210: [linux, Windows] Enable UseSystemMemoryBarrier by default if possible [v2]

David Holmes dholmes at openjdk.org
Mon Feb 27 07:24:05 UTC 2023


On Sat, 25 Feb 2023 16:14:10 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> I'd like to enable UseSystemMemoryBarrier by default on supported Operating Systems in order to improve performance of thread state transitions (I/O, JNI, foreign function calls, JIT compiler threads, etc.). See JBS issue for more details.
>> Unfortunately, the feature was not yet implemented on all platforms. I added the code, but need the platform maintainers to check if it can be used reliably (and ideally if the performance improves). It's easy to switch it off again in case of problems.
>
> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix log message for platforms which don't support it.

Thanks for the pointers to the other discussions. I think we need to see broad benchmarks runs on all affected platforms to ensure this isn't penalizing applications that don't actually need the fast native access.

It may have been better to split this PR in two, first adding support to the platforms missing it, and then changing the flag type and state.

A few comments below.

Thanks

src/hotspot/os/linux/systemMemoryBarrier_linux.cpp line 75:

> 73:   int ret = membarrier(MEMBARRIER_CMD_QUERY, 0, 0);
> 74:   if (ret < 0) {
> 75:     log_trace(os)("MEMBARRIER_CMD_QUERY unsupported");

Why trace? If this should be on by default then I would think info logging would be the right thing here e.g.:

log_info(os)("Use of system memory barriers is not available: MEMBARRIER PRIVATE_EXPEDITED unsupported");

etc.

src/hotspot/share/runtime/threads.cpp line 559:

> 557:     if (!SystemMemoryBarrier::initialize()) {
> 558:       if (!FLAG_IS_DEFAULT(UseSystemMemoryBarrier)) {
> 559:         warning("UseSystemMemoryBarrier specified, but not supported on this OS.");

Possibly add "use -Xlog:os=info for details" (as appropriate given the logging discussion).

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

PR: https://git.openjdk.org/jdk/pull/12753


More information about the hotspot-dev mailing list