• Austin Clements's avatar
    runtime: eliminate runqvictims and a copy from runqsteal · a0fc3060
    Austin Clements authored
    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
    c4fe5031 to eliminate the cost of zeroing it on every steal.
    
    This commit follows up c4fe5031 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/9998Reviewed-by: default avatarRuss Cox <rsc@golang.org>
    Run-TryBot: Austin Clements <austin@google.com>
    a0fc3060
runtime2.go 21.5 KB