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
Backport-of: c9442014e561f8e1cb43a0e9f18a9a5ae2a7a2da
  • Loading branch information
MBaesken committed May 27, 2024
1 parent 4b1d95c commit 00d3ca2
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 @@ -2147,15 +2147,6 @@ char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool
return addr;
}

// 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 @@ -1784,15 +1784,6 @@ char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool
return nullptr;
}

// 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 @@ -4242,25 +4242,6 @@ char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool
return nullptr;
}

// 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 @@ -840,6 +840,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

1 comment on commit 00d3ca2

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.