Skip to content

8372625: [Linux] Remove unnecessary logic for supports_fast_thread_cpu_time#620

Open
mmm-choi wants to merge 1 commit into
openjdk:masterfrom
mmm-choi:JDK-8372625
Open

8372625: [Linux] Remove unnecessary logic for supports_fast_thread_cpu_time#620
mmm-choi wants to merge 1 commit into
openjdk:masterfrom
mmm-choi:JDK-8372625

Conversation

@mmm-choi

@mmm-choi mmm-choi commented Jun 17, 2026

Copy link
Copy Markdown

Would like to get JDK-8372584 into 25u. This is dependent on this backport being integrated first.

This is the first of three related backports that together bring the Linux getCurrentThreadUserTime() performance improvement to 25u. They must be applied in order:

  1. JDK-8372625 (this PR): remove the now-unnecessary supports_fast_thread_cpu_time dual-path logic. Prerequisite.
  2. JDK-8372584 #621: replace /proc parsing with clock_gettime. The actual optimization; depends on this PR.
  3. JDK-8373557 #622: remove comments made stale by JDK-8372584.

This PR is a pure refactoring/cleanup that removes the legacy "fast vs. slow" thread-CPU-time selection logic on Linux, which is dead weight on all currently supported kernels. It is a required base for JDK-8372584 (the function it introduces/renames here, total_thread_cpu_time, is what JDK-8372584 builds on).

Not a clean backport

This required manual conflict resolution. The conflict is not in the logic being changed. It arises because mainline commit (openjdk/jdk@a663812) JDK-8368124 ("Show useful thread names in ASAN reports"), which is not in 25u, had removed the adjacent _pthread_setname_np member.

Resolution: retain _pthread_setname_np (still used by 25u's dlsym-based os::set_native_thread_name) and remove only _pthread_getcpuclockid and _supports_fast_thread_cpu_time, exactly as mainline does. The resulting thread-CPU-time code in os_linux.cppandos_linux.hpp` is byte-for-byte identical to mainline.

Testing

Built release on linux-x86_64 and linux-aarch64 (GCC 10.5, boot JDK 25).
Ran the thread-CPU-time test set on the full 3-commit stack, all pass:

  • java/lang/management/ThreadMXBean/ThreadCpuTime.java, ThreadUserTime.java, VirtualThreads.java
  • vmTestbase/nsk/monitoring/ThreadMXBean/GetThreadCpuTime (10), isThreadCpuTimeSupported (5), isCurrentThreadCpuTimeSupported (5)
  • jdk/jfr/event/runtime/TestThreadCpuTimeEvent.java, jdk/jfr/event/profiling/* (CPU-time sampler)


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8372625 needs maintainer approval

Issue

  • JDK-8372625: [Linux] Remove unnecessary logic for supports_fast_thread_cpu_time (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk25u-dev.git pull/620/head:pull/620
$ git checkout pull/620

Update a local copy of the PR:
$ git checkout pull/620
$ git pull https://git.openjdk.org/jdk25u-dev.git pull/620/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 620

View PR using the GUI difftool:
$ git pr show -t 620

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk25u-dev/pull/620.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper

bridgekeeper Bot commented Jun 17, 2026

Copy link
Copy Markdown

👋 Welcome back mmm-choi! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk

openjdk Bot commented Jun 17, 2026

Copy link
Copy Markdown

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot changed the title Backport 683ef14bcec0e6c4825067229826ed4a53cd3d19 8372625: [Linux] Remove unnecessary logic for supports_fast_thread_cpu_time Jun 17, 2026
@openjdk

openjdk Bot commented Jun 17, 2026

Copy link
Copy Markdown

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk Bot added backport Port of a pull request already in a different code base rfr Pull request is ready for review labels Jun 17, 2026
@mlbridge

mlbridge Bot commented Jun 17, 2026

Copy link
Copy Markdown

Webrevs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport Port of a pull request already in a different code base rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants