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_arm64.s | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/runtime/sys_linux_arm64.s') diff --git a/src/runtime/sys_linux_arm64.s b/src/runtime/sys_linux_arm64.s index 8a56ba6bab..f930d1f044 100644 --- a/src/runtime/sys_linux_arm64.s +++ b/src/runtime/sys_linux_arm64.s @@ -21,7 +21,7 @@ #define SYS_openat 56 #define SYS_close 57 #define SYS_fcntl 25 -#define SYS_pselect6 72 +#define SYS_nanosleep 101 #define SYS_mmap 222 #define SYS_munmap 215 #define SYS_setitimer 103 @@ -129,14 +129,10 @@ TEXT runtimeĀ·usleep(SB),NOSPLIT,$24-4 MUL R4, R5 MOVD R5, 16(RSP) - // pselect6(0, 0, 0, 0, &ts, 0) - MOVD $0, R0 - MOVD R0, R1 - MOVD R0, R2 - MOVD R0, R3 - ADD $8, RSP, R4 - MOVD R0, R5 - MOVD $SYS_pselect6, R8 + // nanosleep(&ts, 0) + ADD $8, RSP, R0 + MOVD $0, R1 + MOVD $SYS_nanosleep, R8 SVC RET -- cgit v1.3