JDK-8338947 : Deprecate the UseLinuxPosixThreadCPUClocks flag and remove it in a future release
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • Submitted: 2024-08-26
  • Updated: 2024-09-02
  • Resolved: 2024-08-26
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 24
24 b13Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Description
The UseLinuxPosixThreadCPUClocks flag was added in Java 6 (JDK-6200022) to control which of two mechanisms was used to obtain the thread CPU time. When true it caused used of the new clock_gettime API with a suitable CLOCK_THREAD_CPUTIME_ID value. When false it caused use of the existing slower reading of /proc/self/<thread>/stat for the information. At the time the Linux implementation of clock_gettime could be incorrect and so you had to opt-in to the faster mechanism if you knew it was working at runtime.

In Java 6u23 and 7 UseLinuxPosixThreadCPUClocks  was enabled by default (as it greatly improved performance of the associated Java-level API - see JDK-6888526) and you could opt out if your Linux kernel did not support it.

Roll forward to JDK 24 and there is no reason for anyone to need to opt-out of this code, so the flag can be deprecated and then removed in the next release. We should also be able to remove the original /proc/self/<thread>/stat reading code.
Comments
Changeset: 16df0907 Branch: master Author: David Holmes <dholmes@openjdk.org> Date: 2024-08-26 22:26:40 +0000 URL: https://git.openjdk.org/jdk/commit/16df0907842af4729e72fe706c76681c8c799c03
26-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20710 Date: 2024-08-26 07:27:23 +0000
26-08-2024