diff options
author | Wang Xuerui <git@xen0n.name> | 2019-11-04 13:29:20 +0000 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@golang.org> | 2019-11-04 18:53:43 +0000 |
commit | 210e3677f997fcce48e749437853203358f1b7b4 (patch) | |
tree | 0a36c2bd7c03f557a99e2dfc54f48b970bf63ffb /src/runtime/vdso_linux_mips64x.go | |
parent | bf7e55b618ff4ec8e823b77c3c775d0fb4dba1ba (diff) | |
download | go-210e3677f997fcce48e749437853203358f1b7b4.tar.gz go-210e3677f997fcce48e749437853203358f1b7b4.zip |
runtime: use vDSO clock_gettime on linux/mips64x
Speed up nanotime1 and walltime1 on MIPS64 with vDSO, just like the
other vDSO-enabled targets.
Benchmark numbers on Loongson 3A3000 (GOARCH=mips64le, 1.4GHz) against
current master:
benchmark old ns/op new ns/op delta
BenchmarkNow 868 293 -66.24%
BenchmarkNowUnixNano 851 296 -65.22%
Performance hit on fallback case, tested by using a wrong vDSO symbol name:
benchmark old ns/op new ns/op delta
BenchmarkNow 868 889 +2.42%
BenchmarkNowUnixNano 851 893 +4.94%
Change-Id: Ibfb48893cd060536359863ffee7624c00def646b
GitHub-Last-Rev: 03a58ac2e4e036a4f61227cfd013082871e92863
GitHub-Pull-Request: golang/go#35181
Reviewed-on: https://go-review.googlesource.com/c/go/+/203578
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/runtime/vdso_linux_mips64x.go')
-rw-r--r-- | src/runtime/vdso_linux_mips64x.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/runtime/vdso_linux_mips64x.go b/src/runtime/vdso_linux_mips64x.go new file mode 100644 index 0000000000..3a0f947612 --- /dev/null +++ b/src/runtime/vdso_linux_mips64x.go @@ -0,0 +1,28 @@ +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build mips64 mips64le + +package runtime + +const ( + // vdsoArrayMax is the byte-size of a maximally sized array on this architecture. + // See cmd/compile/internal/mips64/galign.go arch.MAXWIDTH initialization. + vdsoArrayMax = 1<<50 - 1 +) + +// see man 7 vdso : mips +var vdsoLinuxVersion = vdsoVersionKey{"LINUX_2.6", 0x3ae75f6} + +// The symbol name is not __kernel_clock_gettime as suggested by the manpage; +// according to Linux source code it should be __vdso_clock_gettime instead. +var vdsoSymbolKeys = []vdsoSymbolKey{ + {"__vdso_clock_gettime", 0xd35ec75, 0x6e43a318, &vdsoClockgettimeSym}, +} + +// initialize to fall back to syscall +var ( + vdsoClockgettimeSym uintptr = 0 +) |