Skip to content

Commit

Permalink
8331031: unify os::dont_yield and os::naked_yield across Posix platforms
Browse files Browse the repository at this point in the history
Reviewed-by: coleenp, mdoerr
  • Loading branch information
MBaesken committed Apr 25, 2024
1 parent 8031dab commit c944201
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 37 deletions.
9 changes: 0 additions & 9 deletions src/hotspot/os/aix/os_aix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2059,15 +2059,6 @@ size_t os::vm_min_address() {
return _vm_min_address_default;
}

// Used to convert frequent JVM_Yield() to nops
bool os::dont_yield() {
return DontYieldALot;
}

void os::naked_yield() {
sched_yield();
}

////////////////////////////////////////////////////////////////////////////////
// thread priority support

Expand Down
9 changes: 0 additions & 9 deletions src/hotspot/os/bsd/os_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1936,15 +1936,6 @@ size_t os::vm_min_address() {
#endif
}

// Used to convert frequent JVM_Yield() to nops
bool os::dont_yield() {
return DontYieldALot;
}

void os::naked_yield() {
sched_yield();
}

////////////////////////////////////////////////////////////////////////////////
// thread priority support

Expand Down
19 changes: 0 additions & 19 deletions src/hotspot/os/linux/os_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4310,25 +4310,6 @@ size_t os::vm_min_address() {
return value;
}

// Used to convert frequent JVM_Yield() to nops
bool os::dont_yield() {
return DontYieldALot;
}

// Linux CFS scheduler (since 2.6.23) does not guarantee sched_yield(2) will
// actually give up the CPU. Since skip buddy (v2.6.28):
//
// * Sets the yielding task as skip buddy for current CPU's run queue.
// * Picks next from run queue, if empty, picks a skip buddy (can be the yielding task).
// * Clears skip buddies for this run queue (yielding task no longer a skip buddy).
//
// An alternative is calling os::naked_short_nanosleep with a small number to avoid
// getting re-scheduled immediately.
//
void os::naked_yield() {
sched_yield();
}

////////////////////////////////////////////////////////////////////////////////
// thread priority support

Expand Down
8 changes: 8 additions & 0 deletions src/hotspot/os/posix/os_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,14 @@ void os::_exit(int num) {
ALLOW_C_FUNCTION(::_exit, ::_exit(num);)
}

bool os::dont_yield() {
return DontYieldALot;
}

void os::naked_yield() {
sched_yield();
}

// Builds a platform dependent Agent_OnLoad_<lib_name> function name
// which is used to find statically linked in agents.
// Parameters:
Expand Down

5 comments on commit c944201

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk22u

@openjdk
Copy link

@openjdk openjdk bot commented on c944201 May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken the backport was successfully created on the branch backport-MBaesken-c9442014 in my personal fork of openjdk/jdk22u. To create a pull request with this backport targeting openjdk/jdk22u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit c9442014 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 25 Apr 2024 and was reviewed by Coleen Phillimore and Martin Doerr.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk22u:

$ git fetch https://github.com/openjdk-bots/jdk22u.git backport-MBaesken-c9442014:backport-MBaesken-c9442014
$ git checkout backport-MBaesken-c9442014
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk22u.git backport-MBaesken-c9442014

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk21u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on c944201 May 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MBaesken Could not automatically backport c9442014 to openjdk/jdk21u-dev due to conflicts in the following files:

  • src/hotspot/os/aix/os_aix.cpp
  • src/hotspot/os/bsd/os_bsd.cpp
  • src/hotspot/os/linux/os_linux.cpp

Please fetch the appropriate branch/commit and manually resolve these conflicts by using the following commands in your personal fork of openjdk/jdk21u-dev. Note: these commands are just some suggestions and you can use other equivalent commands you know.

# Fetch the up-to-date version of the target branch
$ git fetch --no-tags https://git.openjdk.org/jdk21u-dev.git master:master

# Check out the target branch and create your own branch to backport
$ git checkout master
$ git checkout -b backport-MBaesken-c9442014

# Fetch the commit you want to backport
$ git fetch --no-tags https://git.openjdk.org/jdk.git c9442014e561f8e1cb43a0e9f18a9a5ae2a7a2da

# Backport the commit
$ git cherry-pick --no-commit c9442014e561f8e1cb43a0e9f18a9a5ae2a7a2da
# Resolve conflicts now

# Commit the files you have modified
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport c9442014e561f8e1cb43a0e9f18a9a5ae2a7a2da'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk21u-dev with the title Backport c9442014e561f8e1cb43a0e9f18a9a5ae2a7a2da.

Below you can find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit c9442014 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 25 Apr 2024 and was reviewed by Coleen Phillimore and Martin Doerr.

Thanks!

Please sign in to comment.