Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(549)

Issue 46170044: code review 46170044: runtime: use lock-free ring for work queues (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
3 months, 3 weeks ago by dvyukov
Modified:
3 months ago
Reviewers:
rsc
CC:
golang-codereviews, rsc, ddetlefs_google.com, dho
Visibility:
Public.

Description

runtime: use lock-free ring for work queues
Use lock-free fixed-size ring for work queues
instead of an unbounded mutex-protected array.
The ring has single producer and multiple consumers.
If the ring overflows, work is put onto global queue.

benchmark              old ns/op    new ns/op    delta
BenchmarkMatmult               7            5  -18.12%
BenchmarkMatmult-4             2            2  -18.98%
BenchmarkMatmult-16            1            0  -12.84%

BenchmarkCreateGoroutines                     105           88  -16.10%
BenchmarkCreateGoroutines-4                   376          219  -41.76%
BenchmarkCreateGoroutines-16                  241          174  -27.80%
BenchmarkCreateGoroutinesParallel             103           87  -14.66%
BenchmarkCreateGoroutinesParallel-4           169          143  -15.38%
BenchmarkCreateGoroutinesParallel-16          158          151   -4.43%

Patch Set 1 #

Patch Set 2 : diff -r 0d4f83bb938b https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 3 : diff -r 0d4f83bb938b https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 4 : diff -r 0d4f83bb938b https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 5 : diff -r 6d39e2fb6154 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 6 : diff -r 6d39e2fb6154 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 7 : diff -r 1e429009e30c https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 8 : diff -r 1e429009e30c https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 9 : diff -r 761cf9b4e530 https://dvyukov%40google.com@code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+121 lines, -136 lines) Patch
M src/pkg/runtime/proc.c View 1 2 3 4 5 6 7 8 12 chunks +118 lines, -132 lines 0 comments Download
M src/pkg/runtime/runtime.h View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -4 lines 0 comments Download

Messages

Total messages: 3
dvyukov
Hello golang-codereviews@googlegroups.com (cc: ddetlefs@google.com, devon.odell@gmail.com), I'd like you to review this change to https://dvyukov%40google.com@code.google.com/p/go/
3 months, 2 weeks ago #1
rsc
LGTM
3 months, 1 week ago #2
dvyukov
3 months ago #3
*** Submitted as https://code.google.com/p/go/source/detail?r=209c0d648d9c ***

runtime: use lock-free ring for work queues
Use lock-free fixed-size ring for work queues
instead of an unbounded mutex-protected array.
The ring has single producer and multiple consumers.
If the ring overflows, work is put onto global queue.

benchmark              old ns/op    new ns/op    delta
BenchmarkMatmult               7            5  -18.12%
BenchmarkMatmult-4             2            2  -18.98%
BenchmarkMatmult-16            1            0  -12.84%

BenchmarkCreateGoroutines                     105           88  -16.10%
BenchmarkCreateGoroutines-4                   376          219  -41.76%
BenchmarkCreateGoroutines-16                  241          174  -27.80%
BenchmarkCreateGoroutinesParallel             103           87  -14.66%
BenchmarkCreateGoroutinesParallel-4           169          143  -15.38%
BenchmarkCreateGoroutinesParallel-16          158          151   -4.43%

R=golang-codereviews, rsc
CC=ddetlefs, devon.odell, golang-codereviews
https://codereview.appspot.com/46170044
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1278:e6ce13d99bf5