Skip to content

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

Closed
mmm-choi wants to merge 2 commits into
openjdk:masterfrom
mmm-choi:JDK-8372625
Closed

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

Conversation

@mmm-choi

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

Copy link
Copy Markdown
Contributor

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

Reviewers

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

@mmm-choi This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8372625: [Linux] Remove unnecessary logic for supports_fast_thread_cpu_time

Reviewed-by: phh

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 70 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@phohensee) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@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

@openjdk

openjdk Bot commented Jun 22, 2026

Copy link
Copy Markdown

⚠️ @mmm-choi This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@mmm-choi

Copy link
Copy Markdown
Contributor Author

/approval request Prerequisite for JDK-8372584 PR #621, which is the actual fix we want in 25 for the long-standing defect JDK-8210452. This PR is pure cleanup: it removes the now-unnecessary supports_fast_thread_cpu_time dual-path logic on Linux. Net code reduction, no behavior change, in mainline since JDK 26 with no regressions, and JDK-8372584 builds directly on it.

@openjdk

openjdk Bot commented Jun 26, 2026

Copy link
Copy Markdown

@mmm-choi
8372625: The approval request has been created successfully.

@openjdk openjdk Bot added the approval Requires approval; will be removed when approval is received label Jun 26, 2026
@openjdk

openjdk Bot commented Jul 24, 2026

Copy link
Copy Markdown

⚠️ @mmm-choi the full name on your profile does not match the author name in this pull requests' HEAD commit. If this pull request gets integrated then the author name from this pull requests' HEAD commit will be used for the resulting commit. If you wish to push a new commit with a different author name, then please run the following commands in a local repository of your personal fork:

$ git checkout JDK-8372625
$ git commit --author='Preferred Full Name <you@example.com>' --allow-empty -m 'Update full name'
$ git push

@openjdk openjdk Bot added ready Pull request is ready to be integrated and removed approval Requires approval; will be removed when approval is received labels Jul 24, 2026
@mmm-choi

Copy link
Copy Markdown
Contributor Author

/integrate

@openjdk openjdk Bot added the sponsor Pull request is ready to be sponsored label Jul 27, 2026
@openjdk

openjdk Bot commented Jul 27, 2026

Copy link
Copy Markdown

@mmm-choi
Your change (at version 770ecd4) is now ready to be sponsored by a Committer.

@phohensee

Copy link
Copy Markdown
Member

/sponsor

@openjdk

openjdk Bot commented Jul 27, 2026

Copy link
Copy Markdown

Going to push as commit 21d24d2.
Since your change was applied there have been 70 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk Bot added the integrated Pull request has been integrated label Jul 27, 2026
@openjdk openjdk Bot closed this Jul 27, 2026
@openjdk openjdk Bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Jul 27, 2026
@openjdk

openjdk Bot commented Jul 27, 2026

Copy link
Copy Markdown

@phohensee @mmm-choi Pushed as commit 21d24d2.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

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 integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants