]> Cypherpunks repositories - gostls13.git/commit
runtime: remove locks from netpoll hotpaths
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 22 Jan 2014 07:27:16 +0000 (11:27 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 22 Jan 2014 07:27:16 +0000 (11:27 +0400)
commit9cbd2fb1aa7ac3d4cd33442a93187d8549dbf1c4
tree45e7c0673ece855ac42aa5d52395d56d524ad0c2
parentcb86d867866514bb751e1caa16425002db54e303
runtime: remove locks from netpoll hotpaths
Introduces two-phase goroutine parking mechanism -- prepare to park, commit park.
This mechanism does not require backing mutex to protect wait predicate.
Use it in netpoll. See comment in netpoll.goc for details.
This slightly reduces contention between reader, writer and read/write io notifications;
and just eliminates a bunch of mutex operations from hotpaths, thus making then faster.

benchmark                             old ns/op    new ns/op    delta
BenchmarkTCP4ConcurrentReadWrite           2109         1945   -7.78%
BenchmarkTCP4ConcurrentReadWrite-2         1162         1113   -4.22%
BenchmarkTCP4ConcurrentReadWrite-4          798          755   -5.39%
BenchmarkTCP4ConcurrentReadWrite-8          803          748   -6.85%
BenchmarkTCP4Persistent                    9411         9240   -1.82%
BenchmarkTCP4Persistent-2                  5888         5813   -1.27%
BenchmarkTCP4Persistent-4                  4016         3968   -1.20%
BenchmarkTCP4Persistent-8                  3943         3857   -2.18%

R=golang-codereviews, mikioh.mikioh, gobot, iant, rsc
CC=golang-codereviews, khr
https://golang.org/cl/45700043
src/pkg/runtime/asm_386.s
src/pkg/runtime/asm_amd64.s
src/pkg/runtime/atomic_arm.c
src/pkg/runtime/chan.c
src/pkg/runtime/mgc0.c
src/pkg/runtime/netpoll.goc
src/pkg/runtime/proc.c
src/pkg/runtime/runtime.h
src/pkg/runtime/sema.goc
src/pkg/runtime/time.goc