RFR(s): 8214180: Need better granularity for sleeping

Daniel D. Daugherty daniel.daugherty at oracle.com
Sat Nov 24 14:28:06 UTC 2018


On 11/21/18 9:06 AM, Robbin Ehn wrote:
> Hi all, please review.
>
> naked_short_sleep is to coarse grained on contemporary hardware/os:es.
> 1 ms as minimum when we can complete an entire safe-point in 0.5 ms is 
> a very long time.
> Sleeping a very short time instead yielding have several uses-cases.
>
> Here I add it SpinYield to get much smother back-off delay curve.
> Which means it will be usable in more places.
>
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8214180
>
> Webrev:
> http://cr.openjdk.java.net/~rehn/8214180/webrev/

src/hotspot/os/aix/os_aix.cpp
     No comments.

src/hotspot/os/bsd/os_bsd.cpp
     No comments.

src/hotspot/os/linux/os_linux.cpp
     old L4030 // Short sleep, direct OS call.
     old L4031 //
     old L4032 // Note: certain versions of Linux CFS scheduler (since 
2.6.23) do not guarantee
     old L4033 // sched_yield(2) will actually give up the CPU:
     old L4034 //
     old L4035 //   * Alone on this pariticular CPU, keeps running.
     old L4036 //   * Before the introduction of "skip_buddy" with 
"compat_yield" disabled
     old L4037 //     (pre 2.6.39).
     old L4038 //
     old L4039 // So calling this with 0 is an alternative.
     old L4040 //
         I noticed this comment didn't get copied over to os_posix.cpp.
         Is the comment about an old enough Linux kernel that it is no
         longer useful?

src/hotspot/os/posix/os_posix.cpp
     No comments.

src/hotspot/os/solaris/os_solaris.cpp
     No comments.

src/hotspot/os/windows/os_windows.cpp
     No comments.

src/hotspot/share/runtime/os.hpp
     No comments.

src/hotspot/share/utilities/spinYield.cpp
     No comments.

src/hotspot/share/utilities/spinYield.hpp
     No comments.

Thumbs up.

Dan


>
> Passes t1-3.
>
> Thanks, Robbin



More information about the hotspot-runtime-dev mailing list