Descriptionruntime: 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%
Patch Set 1 #Patch Set 2 : diff -r 176779a4ebed https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 3 : diff -r 176779a4ebed https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 4 : diff -r 176779a4ebed https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 5 : diff -r 176779a4ebed https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 6 : diff -r 9963a911bc14 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 7 : diff -r 9fd412c6b156 https://dvyukov%40google.com@code.google.com/p/go/ #
Total comments: 5
Patch Set 8 : diff -r d5dbdcc7f614 https://dvyukov%40google.com@code.google.com/p/go/ #
Total comments: 2
Patch Set 9 : diff -r 5b5a2d2d2563 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 10 : diff -r 5b5a2d2d2563 https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 11 : diff -r 5b5a2d2d2563 https://dvyukov%40google.com@code.google.com/p/go/ #
Total comments: 9
Patch Set 12 : diff -r 60a0c4c04f5f https://dvyukov%40google.com@code.google.com/p/go/ #Patch Set 13 : diff -r 60a0c4c04f5f https://dvyukov%40google.com@code.google.com/p/go/ #
MessagesTotal messages: 13
|