• Dmitriy Vyukov's avatar
    runtime: remove locks from netpoll hotpaths · 9cbd2fb1
    Dmitriy Vyukov authored
    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
    9cbd2fb1
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...