aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/linux/amd64/sys.s
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-09-30 09:40:01 -0400
committerRuss Cox <rsc@golang.org>2011-09-30 09:40:01 -0400
commitd324f2143b2b7dade319ce70261f3441041710e9 (patch)
tree4585d96f7503b401c7d0fe07d2e452bf0ae808bc /src/pkg/runtime/linux/amd64/sys.s
parentb0cddb98b9b29c9a153bae83095d5f13cbcc4bda (diff)
downloadgo-d324f2143b2b7dade319ce70261f3441041710e9.tar.xz
runtime: parallelize garbage collector mark + sweep
Running test/garbage/parser.out. On a 4-core Lenovo X201s (Linux): 31.12u 0.60s 31.74r 1 cpu, no atomics 32.27u 0.58s 32.86r 1 cpu, atomic instructions 33.04u 0.83s 27.47r 2 cpu On a 16-core Xeon (Linux): 33.08u 0.65s 33.80r 1 cpu, no atomics 34.87u 1.12s 29.60r 2 cpu 36.00u 1.87s 28.43r 3 cpu 36.46u 2.34s 27.10r 4 cpu 38.28u 3.85s 26.92r 5 cpu 37.72u 5.25s 26.73r 6 cpu 39.63u 7.11s 26.95r 7 cpu 39.67u 8.10s 26.68r 8 cpu On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5): 39.43u 1.45s 41.27r 1 cpu, no atomics 43.98u 2.95s 38.69r 2 cpu On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1): 48.81u 2.12s 51.76r 1 cpu, no atomics 57.15u 4.72s 51.54r 2 cpu The handoff algorithm is really only good for two cores. Beyond that we will need to so something more sophisticated, like have each core hand off to the next one, around a circle. Even so, the code is a good checkpoint; for now we'll limit the number of gc procs to at most 2. R=dvyukov CC=golang-dev https://golang.org/cl/4641082
Diffstat (limited to 'src/pkg/runtime/linux/amd64/sys.s')
-rw-r--r--src/pkg/runtime/linux/amd64/sys.s22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/pkg/runtime/linux/amd64/sys.s b/src/pkg/runtime/linux/amd64/sys.s
index 8b4dcd921e..3174af2cb0 100644
--- a/src/pkg/runtime/linux/amd64/sys.s
+++ b/src/pkg/runtime/linux/amd64/sys.s
@@ -50,6 +50,24 @@ TEXT runtime·read(SB),7,$0-24
SYSCALL
RET
+TEXT runtime·usleep(SB),7,$16
+ MOVL $0, DX
+ MOVL usec+0(FP), AX
+ MOVL $1000000, CX
+ DIVL CX
+ MOVQ AX, 0(SP)
+ MOVQ DX, 8(SP)
+
+ // select(0, 0, 0, 0, &tv)
+ MOVL $0, DI
+ MOVL $0, SI
+ MOVL $0, DX
+ MOVL $0, R10
+ MOVQ SP, R8
+ MOVL $23, AX
+ SYSCALL
+ RET
+
TEXT runtime·raisesigpipe(SB),7,$12
MOVL $186, AX // syscall - gettid
SYSCALL
@@ -195,10 +213,10 @@ TEXT runtime·clone(SB),7,$0
CMPQ AX, $0
JEQ 2(PC)
RET
-
+
// In child, on new stack.
MOVQ SI, SP
-
+
// Initialize m->procid to Linux tid
MOVL $186, AX // gettid
SYSCALL