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_arm.s | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/runtime/sys_linux_arm.s') diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s index 4dd773adce..fc9dc9bbb8 100644 --- a/src/runtime/sys_linux_arm.s +++ b/src/runtime/sys_linux_arm.s @@ -38,7 +38,7 @@ #define SYS_gettid (SYS_BASE + 224) #define SYS_tkill (SYS_BASE + 238) #define SYS_sched_yield (SYS_BASE + 158) -#define SYS_pselect6 (SYS_BASE + 335) +#define SYS_nanosleep (SYS_BASE + 162) #define SYS_sched_getaffinity (SYS_BASE + 242) #define SYS_clock_gettime (SYS_BASE + 263) #define SYS_epoll_create (SYS_BASE + 250) @@ -475,13 +475,9 @@ TEXT runtimeĀ·usleep(SB),NOSPLIT,$12 MOVW $1000, R0 // usec to nsec MUL R0, R1 MOVW R1, 8(R13) - MOVW $0, R0 + MOVW $4(R13), R0 MOVW $0, R1 - MOVW $0, R2 - MOVW $0, R3 - MOVW $4(R13), R4 - MOVW $0, R5 - MOVW $SYS_pselect6, R7 + MOVW $SYS_nanosleep, R7 SWI $0 RET -- cgit v1.3