Obsolete/remove unused UseBsdPosixThreadCPUClocks

David Holmes david.holmes at oracle.com
Sun Jun 7 04:16:13 UTC 2020


Hi Christoph,

On 7/06/2020 4:54 am, Christoph Dreis wrote:
> Hi,
> 
> Please forgive me if this is not the correct mailing list.
> 
> I've stumbled upon UseBsdPosixThreadCPUClocks that seems unused in the code.

Yes. The BSD/macOS port was based on the Linux port and in many instance 
there was a global replace of "linux" with "BSD" resulting in a lot of 
inappropriate code in the BSD port.

> I don't know what the process for already unused flags is.
> E.g. if they need to be deprecated first or can be removed directly.

If the flag is functional (and a product flag) then the process would 
normally be to first deprecate (which still applies the flag but issues 
a warning), then obsolete (ignore the flag and issue a warning), then 
expire it (which gives an error about an unknown flag).

In cases like this, where the flag actually does nothing then you can 
request immediate obsoletion.

A bug will need to be filed, and a CSR request created for the bug.

> I've prepared two patches - one for each option:
> 
> ===== REMOVAL PATCH =====
> --- a/src/hotspot/os/bsd/globals_bsd.hpp        Sat Jun 06 08:13:40 2020 +0000
> +++ b/src/hotspot/os/bsd/globals_bsd.hpp        Sat Jun 06 20:25:58 2020 +0200
> @@ -40,11 +40,6 @@
>                                                                                   \
>     product(bool, UseOprofile, false,                                             \
>           "enable support for Oprofile profiler")                                 \
> -                                                                                \
> -  /*  NB: The default value of UseBsdPosixThreadCPUClocks may be  */            \
> -  /*  overridden in Arguments::parse_each_vm_init_arg.            */            \
> -  product(bool, UseBsdPosixThreadCPUClocks, true,                               \
> -          "enable fast Bsd Posix clocks where available")                       \

Obsoleting the flag still requires an entry in the flag table in 
arguments.cpp

> ===== DEPRECATION PATCH =====
> --- a/src/hotspot/share/runtime/arguments.cpp   Sat Jun 06 08:13:40 2020 +0000
> +++ b/src/hotspot/share/runtime/arguments.cpp   Sat Jun 06 20:48:05 2020 +0200
> @@ -535,6 +535,7 @@
>     { "PrintPreciseBiasedLockingStatistics", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
>     { "InitialBootClassLoaderMetaspaceSize", JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
>     { "UseLargePagesInMetaspace",            JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },
> +  { "UseBsdPosixThreadCPUClocks",          JDK_Version::jdk(15), JDK_Version::jdk(16), JDK_Version::jdk(17) },

As the flag only exists for BSD it will need to be in a ifdef guard for BSD.

>     // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in:
>     { "DefaultMaxRAMFraction",        JDK_Version::jdk(8),  JDK_Version::undefined(), JDK_Version::undefined() },
> 
> In case you think this is worthwhile, I'd appreciate if someone can sponsor this change.
> (I've contributed to core-libs before, so CLA is signed)

We hit rampdown phase one for JDK 15 this Wednesday so it is a bit late 
to try and get this into 15 now (the CSR process would not be complete 
in time). But I will file the bug and CSR request to get this cleaned up 
for JDK 16.

Thanks,
David

> Cheers,
> Christoph
> 
> 


More information about the hotspot-runtime-dev mailing list