aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2015-05-13 17:08:16 -0400
committerAustin Clements <austin@google.com>2015-05-17 01:08:42 +0000
commita0fc306023d77e5605203c14ca92f368bdbce3ae (patch)
tree48a38a96eee0d0b96186e9a5f2a92fd6e1d92e55 /src/runtime/runtime2.go
parentab4e7988bb30eaf43ef9c5b4dcedc30502a0b0e6 (diff)
downloadgo-a0fc306023d77e5605203c14ca92f368bdbce3ae.tar.xz
runtime: eliminate runqvictims and a copy from runqsteal
Currently, runqsteal steals Gs from another P into an intermediate buffer and then copies those Gs into the current P's run queue. This intermediate buffer itself was moved from the stack to the P in commit c4fe503 to eliminate the cost of zeroing it on every steal. This commit follows up c4fe503 by stealing directly into the current P's run queue, which eliminates the copy and the need for the intermediate buffer. The update to the tail pointer is only committed once the entire steal operation has succeeded, so the semantics of stealing do not change. Change-Id: Icdd7a0eb82668980bf42c0154b51eef6419fdd51 Reviewed-on: https://go-review.googlesource.com/9998 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Austin Clements <austin@google.com>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index ae93bb8dcb..8dfece5845 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -353,10 +353,9 @@ type p struct {
goidcacheend uint64
// Queue of runnable goroutines. Accessed without lock.
- runqhead uint32
- runqtail uint32
- runq [256]*g
- runqvictims [128]*g // Used to stage victims from another p's runq
+ runqhead uint32
+ runqtail uint32
+ runq [256]*g
// runnext, if non-nil, is a runnable G that was ready'd by
// the current G and should be run next instead of what's in
// runq if there's time remaining in the running G's time