diff options
| author | Shenghou Ma <minux.ma@gmail.com> | 2013-03-16 04:01:56 +0800 |
|---|---|---|
| committer | Shenghou Ma <minux.ma@gmail.com> | 2013-03-16 04:01:56 +0800 |
| commit | 1d64d04da5f54f2fc0c9801c908380b633ea67d9 (patch) | |
| tree | 7535af17a9e00cb387a975e280d4dcb688ca35cd /src/pkg/runtime | |
| parent | 615f289209d08316da2c609f843bd20201ce2275 (diff) | |
| download | go-1d64d04da5f54f2fc0c9801c908380b633ea67d9.tar.xz | |
net, runtime: enable runtime-integrated pollster on Linux/ARM.
Results from linux/arm on a Samsung Chromebook (from dfc):
localhost(~/go/src/pkg/net) % ~/go/misc/benchcmp {old,new}.txt
benchmark old ns/op new ns/op delta
BenchmarkTCP4OneShot 568840 350526 -38.38%
BenchmarkTCP4OneShot-2 359054 206708 -42.43%
BenchmarkTCP4OneShotTimeout 637464 363550 -42.97%
BenchmarkTCP4OneShotTimeout-2 374255 216695 -42.10%
BenchmarkTCP4Persistent 184974 64984 -64.87%
BenchmarkTCP4Persistent-2 109902 47195 -57.06%
BenchmarkTCP4PersistentTimeout 210039 64789 -69.15%
BenchmarkTCP4PersistentTimeout-2 124284 43374 -65.10%
BenchmarkTCP6OneShot 672278 362116 -46.14%
BenchmarkTCP6OneShot-2 383631 216400 -43.59%
BenchmarkTCP6OneShotTimeout 680740 378306 -44.43%
BenchmarkTCP6OneShotTimeout-2 397524 230152 -42.10%
BenchmarkTCP6Persistent 172346 65292 -62.12%
BenchmarkTCP6Persistent-2 106229 42096 -60.37%
BenchmarkTCP6PersistentTimeout 161149 65138 -59.58%
BenchmarkTCP6PersistentTimeout-2 152276 44548 -70.75%
R=golang-dev, dave, bradfitz, dvyukov, rsc
CC=golang-dev
https://golang.org/cl/7820045
Diffstat (limited to 'src/pkg/runtime')
| -rw-r--r-- | src/pkg/runtime/defs_linux_arm.h | 19 | ||||
| -rw-r--r-- | src/pkg/runtime/netpoll.goc | 2 | ||||
| -rw-r--r-- | src/pkg/runtime/netpoll_epoll.c | 2 | ||||
| -rw-r--r-- | src/pkg/runtime/netpoll_stub.c | 2 | ||||
| -rw-r--r-- | src/pkg/runtime/sys_linux_arm.s | 49 |
5 files changed, 70 insertions, 4 deletions
diff --git a/src/pkg/runtime/defs_linux_arm.h b/src/pkg/runtime/defs_linux_arm.h index 82442b23e0..92160966e1 100644 --- a/src/pkg/runtime/defs_linux_arm.h +++ b/src/pkg/runtime/defs_linux_arm.h @@ -2,6 +2,7 @@ // Constants enum { + EINTR = 0x4, ENOMEM = 0xc, EAGAIN = 0xb, @@ -65,6 +66,17 @@ enum { ITIMER_VIRTUAL = 0x1, O_RDONLY = 0, O_CLOEXEC = 02000000, + + EPOLLIN = 0x1, + EPOLLOUT = 0x4, + EPOLLERR = 0x8, + EPOLLHUP = 0x10, + EPOLLRDHUP = 0x2000, + EPOLLET = -0x80000000, + EPOLL_CLOEXEC = 0x80000, + EPOLL_CTL_ADD = 0x1, + EPOLL_CTL_DEL = 0x2, + EPOLL_CTL_MOD = 0x3, }; // Types @@ -146,4 +158,11 @@ struct Sigaction { void *sa_restorer; uint64 sa_mask; }; + +typedef struct EpollEvent EpollEvent; +struct EpollEvent { + uint32 events; + uint32 _pad; + uint64 data; +}; #pragma pack off diff --git a/src/pkg/runtime/netpoll.goc b/src/pkg/runtime/netpoll.goc index 152fa174e9..b314c65338 100644 --- a/src/pkg/runtime/netpoll.goc +++ b/src/pkg/runtime/netpoll.goc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin linux,386 linux,amd64 +// +build darwin linux package net diff --git a/src/pkg/runtime/netpoll_epoll.c b/src/pkg/runtime/netpoll_epoll.c index 53916e1d2e..34ed78addb 100644 --- a/src/pkg/runtime/netpoll_epoll.c +++ b/src/pkg/runtime/netpoll_epoll.c @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux,386 linux,amd64 +// +build linux #include "runtime.h" #include "defs_GOOS_GOARCH.h" diff --git a/src/pkg/runtime/netpoll_stub.c b/src/pkg/runtime/netpoll_stub.c index a70b2f772f..39d19a4cea 100644 --- a/src/pkg/runtime/netpoll_stub.c +++ b/src/pkg/runtime/netpoll_stub.c @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build freebsd linux,arm netbsd openbsd plan9 windows +// +build freebsd netbsd openbsd plan9 windows #include "runtime.h" diff --git a/src/pkg/runtime/sys_linux_arm.s b/src/pkg/runtime/sys_linux_arm.s index e3994bccaa..7f813482d1 100644 --- a/src/pkg/runtime/sys_linux_arm.s +++ b/src/pkg/runtime/sys_linux_arm.s @@ -36,6 +36,11 @@ #define SYS_ugetrlimit (SYS_BASE + 191) #define SYS_sched_getaffinity (SYS_BASE + 242) #define SYS_clock_gettime (SYS_BASE + 263) +#define SYS_epoll_create (SYS_BASE + 250) +#define SYS_epoll_ctl (SYS_BASE + 251) +#define SYS_epoll_wait (SYS_BASE + 252) +#define SYS_epoll_create1 (SYS_BASE + 357) +#define SYS_fcntl (SYS_BASE + 55) #define ARM_BASE (SYS_BASE + 0x0f0000) @@ -371,7 +376,6 @@ cascheck: MOVW $0, R0 RET - TEXT runtime·casp(SB),7,$0 B runtime·cas(SB) @@ -387,3 +391,46 @@ TEXT runtime·sched_getaffinity(SB),7,$0 MOVW $SYS_sched_getaffinity, R7 SWI $0 RET + +// int32 runtime·epollcreate(int32 size) +TEXT runtime·epollcreate(SB),7,$0 + MOVW 0(FP), R0 + MOVW $SYS_epoll_create, R7 + SWI $0 + RET + +// int32 runtime·epollcreate1(int32 flags) +TEXT runtime·epollcreate1(SB),7,$0 + MOVW 0(FP), R0 + MOVW $SYS_epoll_create1, R7 + SWI $0 + RET + +// int32 runtime·epollctl(int32 epfd, int32 op, int32 fd, EpollEvent *ev) +TEXT runtime·epollctl(SB),7,$0 + MOVW 0(FP), R0 + MOVW 4(FP), R1 + MOVW 8(FP), R2 + MOVW 12(FP), R3 + MOVW $SYS_epoll_ctl, R7 + SWI $0 + RET + +// int32 runtime·epollwait(int32 epfd, EpollEvent *ev, int32 nev, int32 timeout) +TEXT runtime·epollwait(SB),7,$0 + MOVW 0(FP), R0 + MOVW 4(FP), R1 + MOVW 8(FP), R2 + MOVW 12(FP), R3 + MOVW $SYS_epoll_wait, R7 + SWI $0 + RET + +// void runtime·closeonexec(int32 fd) +TEXT runtime·closeonexec(SB),7,$0 + MOVW 0(FP), R0 // fd + MOVW $2, R1 // F_SETFD + MOVW $1, R2 // FD_CLOEXEC + MOVW $SYS_fcntl, R7 + SWI $0 + RET |
