aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/sys_linux_amd64.s
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2018-04-20 15:30:52 -0700
committerIan Lance Taylor <iant@golang.org>2018-04-24 05:01:13 +0000
commit665b9b3476ad0a6dc4e578e42e6c63012e23aaa0 (patch)
tree4848606a8cb62e0a46e8f70983a2d32c75836ef3 /src/runtime/sys_linux_amd64.s
parenta3c75d9b313cc9f06969125ff28501c081dac3b8 (diff)
downloadgo-665b9b3476ad0a6dc4e578e42e6c63012e23aaa0.tar.gz
go-665b9b3476ad0a6dc4e578e42e6c63012e23aaa0.zip
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 <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_amd64.s')
-rw-r--r--src/runtime/sys_linux_amd64.s12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/runtime/sys_linux_amd64.s b/src/runtime/sys_linux_amd64.s
index e03f7ce44c..62d80247be 100644
--- a/src/runtime/sys_linux_amd64.s
+++ b/src/runtime/sys_linux_amd64.s
@@ -24,6 +24,7 @@
#define SYS_sched_yield 24
#define SYS_mincore 27
#define SYS_madvise 28
+#define SYS_nanosleep 35
#define SYS_setittimer 38
#define SYS_getpid 39
#define SYS_socket 41
@@ -43,7 +44,6 @@
#define SYS_epoll_ctl 233
#define SYS_openat 257
#define SYS_faccessat 269
-#define SYS_pselect6 270
#define SYS_epoll_pwait 281
#define SYS_epoll_create1 291
@@ -123,14 +123,10 @@ TEXT runtimeĀ·usleep(SB),NOSPLIT,$16
MULL DX
MOVQ AX, 8(SP)
- // pselect6(0, 0, 0, 0, &ts, 0)
- MOVL $0, DI
+ // nanosleep(&ts, 0)
+ MOVQ SP, DI
MOVL $0, SI
- MOVL $0, DX
- MOVL $0, R10
- MOVQ SP, R8
- MOVL $0, R9
- MOVL $SYS_pselect6, AX
+ MOVL $SYS_nanosleep, AX
SYSCALL
RET