From 665b9b3476ad0a6dc4e578e42e6c63012e23aaa0 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 20 Apr 2018 15:30:52 -0700 Subject: runtime: change GNU/Linux usleep to use nanosleep Ever since we added sleep to the runtime back in 2008, we've implemented it on GNU/Linux with the select (or pselect or pselect6) system call. But the Linux kernel has a nanosleep system call, which should be a tiny bit more efficient since it doesn't have to check to see whether there are any file descriptors. So use it. Change-Id: Icc3430baca46b082a4d33f97c6c47e25fa91cb9a Reviewed-on: https://go-review.googlesource.com/108538 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/runtime/sys_linux_ppc64x.s | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/runtime/sys_linux_ppc64x.s') diff --git a/src/runtime/sys_linux_ppc64x.s b/src/runtime/sys_linux_ppc64x.s index 77ddf53286..b8fe5cc31b 100644 --- a/src/runtime/sys_linux_ppc64x.s +++ b/src/runtime/sys_linux_ppc64x.s @@ -27,8 +27,8 @@ #define SYS_munmap 91 #define SYS_setitimer 104 #define SYS_clone 120 -#define SYS_newselect 142 #define SYS_sched_yield 158 +#define SYS_nanosleep 162 #define SYS_rt_sigreturn 172 #define SYS_rt_sigaction 173 #define SYS_rt_sigprocmask 174 @@ -106,17 +106,15 @@ TEXT runtimeĀ·usleep(SB),NOSPLIT,$16-4 MOVW $1000000, R4 DIVD R4, R3 MOVD R3, 8(R1) + MOVW $1000, R4 MULLD R3, R4 SUB R4, R5 MOVD R5, 16(R1) - // select(0, 0, 0, 0, &tv) - MOVW $0, R3 + // nanosleep(&ts, 0) + ADD $8, R1, R3 MOVW $0, R4 - MOVW $0, R5 - MOVW $0, R6 - ADD $8, R1, R7 - SYSCALL $SYS_newselect + SYSCALL $SYS_nanosleep RET TEXT runtimeĀ·gettid(SB),NOSPLIT,$0-4 -- cgit v1.3-5-g9baa