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

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


On Mon, 27 Feb 2023 06:56:49 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> 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.
>
> 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.

Also log in the success case too, before returning.

> 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).

Also, with the flag checking this code now looks to be in the wrong place. Flag warnings typically belong is arguments.cpp.
Actually I think this code belongs in os::init() regardless.

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

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


More information about the hotspot-dev mailing list