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

Issue 4641082: code review 4641082: runtime: parallelize garbage collector mark + sweep (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 1 month ago by rsc
Modified:
12 years, 10 months ago
Reviewers:
CC:
dvyukov, golang-dev
Visibility:
Public.

Description

runtime: parallelize garbage collector mark + sweep Running test/garbage/parser.out. On a 4-core Lenovo X201s (Linux): 31.12u 0.60s 31.74r 1 cpu, no atomics 32.27u 0.58s 32.86r 1 cpu, atomic instructions 33.04u 0.83s 27.47r 2 cpu On a 16-core Xeon (Linux): 33.08u 0.65s 33.80r 1 cpu, no atomics 34.87u 1.12s 29.60r 2 cpu 36.00u 1.87s 28.43r 3 cpu 36.46u 2.34s 27.10r 4 cpu 38.28u 3.85s 26.92r 5 cpu 37.72u 5.25s 26.73r 6 cpu 39.63u 7.11s 26.95r 7 cpu 39.67u 8.10s 26.68r 8 cpu On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5): 39.43u 1.45s 41.27r 1 cpu, no atomics 43.98u 2.95s 38.69r 2 cpu On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1): 48.81u 2.12s 51.76r 1 cpu, no atomics 57.15u 4.72s 51.54r 2 cpu The handoff algorithm is really only good for two cores. Beyond that we will need to so something more sophisticated, like have each core hand off to the next one, around a circle. Even so, the code is a good checkpoint; for now we'll limit the number of gc procs to at most 2.

Patch Set 1 #

Patch Set 2 : diff -r a1541ae18b69 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r e540ff37120d https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r e540ff37120d https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r e540ff37120d https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 54cef9de2177 https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 54cef9de2177 https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 54cef9de2177 https://go.googlecode.com/hg/ #

Patch Set 9 : diff -r ce2e5f44b310 https://go.googlecode.com/hg #

Patch Set 10 : diff -r db925aedad3d https://go.googlecode.com/hg #

Patch Set 11 : diff -r db925aedad3d https://go.googlecode.com/hg #

Patch Set 12 : diff -r db925aedad3d https://go.googlecode.com/hg #

Total comments: 13

Patch Set 13 : diff -r 41d5abd18c57 https://go.googlecode.com/hg/ #

Patch Set 14 : diff -r 41d5abd18c57 https://go.googlecode.com/hg/ #

Patch Set 15 : diff -r 41d5abd18c57 https://go.googlecode.com/hg/ #

Patch Set 16 : diff -r 41d5abd18c57 https://go.googlecode.com/hg/ #

Patch Set 17 : diff -r 41d5abd18c57 https://go.googlecode.com/hg/ #

Patch Set 18 : diff -r 41d5abd18c57 https://go.googlecode.com/hg/ #

Total comments: 8

Patch Set 19 : diff -r 9a44dedca5dd https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 20 : diff -r 978acc122f2e https://go.googlecode.com/hg/ #

Patch Set 21 : diff -r 978acc122f2e https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+707 lines, -167 lines) Patch
M src/pkg/runtime/darwin/386/sys.s View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +31 lines, -2 lines 0 comments Download
M src/pkg/runtime/darwin/amd64/sys.s View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +36 lines, -3 lines 0 comments Download
M src/pkg/runtime/darwin/os.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/runtime/darwin/thread.c View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +14 lines, -0 lines 0 comments Download
M src/pkg/runtime/linux/386/sys.s View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +25 lines, -6 lines 0 comments Download
M src/pkg/runtime/linux/amd64/sys.s View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +20 lines, -2 lines 0 comments Download
M src/pkg/runtime/linux/arm/sys.s View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +20 lines, -2 lines 0 comments Download
M src/pkg/runtime/linux/thread.c View 1 2 3 4 5 6 7 8 3 chunks +2 lines, -5 lines 0 comments Download
M src/pkg/runtime/malloc.h View 1 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 8 chunks +15 lines, -6 lines 0 comments Download
M src/pkg/runtime/mgc0.c View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 29 chunks +431 lines, -90 lines 0 comments Download
M src/pkg/runtime/print.c View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +3 lines, -3 lines 0 comments Download
M src/pkg/runtime/proc.c View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 10 chunks +103 lines, -35 lines 0 comments Download
M src/pkg/runtime/runtime.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 5 chunks +5 lines, -2 lines 0 comments Download
M test/garbage/Makefile View 1 2 1 chunk +1 line, -1 line 0 comments Download
M test/garbage/parser.go View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +0 lines, -10 lines 0 comments Download

Messages

Total messages: 15
rsc
Hello dvyukov (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg
12 years, 11 months ago (2011-09-06 18:01:59 UTC) #1
rsc
I would appreciate some advice about the spinning algorithm. It's obviously just a giant hack ...
12 years, 11 months ago (2011-09-06 18:02:27 UTC) #2
dvyukov
http://codereview.appspot.com/4641082/diff/35003/src/pkg/runtime/mgc0.c File src/pkg/runtime/mgc0.c (right): http://codereview.appspot.com/4641082/diff/35003/src/pkg/runtime/mgc0.c#newcode54 src/pkg/runtime/mgc0.c:54: static uint64 nlookup; Ultimately we want the statistics to ...
12 years, 11 months ago (2011-09-07 11:10:50 UTC) #3
dvyukov
http://codereview.appspot.com/4641082/diff/35003/src/pkg/runtime/mgc0.c File src/pkg/runtime/mgc0.c (right): http://codereview.appspot.com/4641082/diff/35003/src/pkg/runtime/mgc0.c#newcode242 src/pkg/runtime/mgc0.c:242: if(nobj > 0 && (localneed = work.need) != nil ...
12 years, 11 months ago (2011-09-07 13:58:23 UTC) #4
rsc
On Wed, Sep 7, 2011 at 09:58, <dvyukov@google.com> wrote: > I think we need to ...
12 years, 10 months ago (2011-09-23 14:35:09 UTC) #5
dvyukov
On 2011/09/23 14:35:09, rsc wrote: > On Wed, Sep 7, 2011 at 09:58, <mailto:dvyukov@google.com> wrote: ...
12 years, 10 months ago (2011-09-23 21:00:57 UTC) #6
rsc
Hello dvyukov@google.com (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 10 months ago (2011-09-26 16:46:04 UTC) #7
dvyukov
http://codereview.appspot.com/4641082/diff/59001/src/pkg/runtime/malloc.h File src/pkg/runtime/malloc.h (right): http://codereview.appspot.com/4641082/diff/59001/src/pkg/runtime/malloc.h#newcode129 src/pkg/runtime/malloc.h:129: MaxGcproc = 64, Don't we want to still limit ...
12 years, 10 months ago (2011-09-27 17:57:32 UTC) #8
dvyukov
http://codereview.appspot.com/4641082/diff/59001/src/pkg/runtime/mgc0.c File src/pkg/runtime/mgc0.c (right): http://codereview.appspot.com/4641082/diff/59001/src/pkg/runtime/mgc0.c#newcode66 src/pkg/runtime/mgc0.c:66: byte **bp; Why we need the bp pointer at ...
12 years, 10 months ago (2011-09-27 18:17:16 UTC) #9
dvyukov
http://codereview.appspot.com/4641082/diff/59001/src/pkg/runtime/mgc0.c File src/pkg/runtime/mgc0.c (right): http://codereview.appspot.com/4641082/diff/59001/src/pkg/runtime/mgc0.c#newcode707 src/pkg/runtime/mgc0.c:707: scan(nil, 0); So, why it is before walkfintab? As ...
12 years, 10 months ago (2011-09-27 20:32:17 UTC) #10
rsc
On Tue, Sep 27, 2011 at 14:17, <dvyukov@google.com> wrote: > Why we need the bp ...
12 years, 10 months ago (2011-09-28 17:57:07 UTC) #11
dvyukov
On 2011/09/28 17:57:07, rsc wrote: > On Tue, Sep 27, 2011 at 14:17, <mailto:dvyukov@google.com> wrote: ...
12 years, 10 months ago (2011-09-28 18:45:18 UTC) #12
rsc
Hello dvyukov@google.com (cc: golang-dev@googlegroups.com), Please take another look.
12 years, 10 months ago (2011-09-28 23:59:15 UTC) #13
dvyukov
LGTM after the fix http://codereview.appspot.com/4641082/diff/70001/src/pkg/runtime/proc.c File src/pkg/runtime/proc.c (right): http://codereview.appspot.com/4641082/diff/70001/src/pkg/runtime/proc.c#newcode626 src/pkg/runtime/proc.c:626: runtime·sched.mhead = m->schedlink; remove
12 years, 10 months ago (2011-09-29 21:21:11 UTC) #14
rsc
12 years, 10 months ago (2011-09-30 13:40:13 UTC) #15
*** Submitted as http://code.google.com/p/go/source/detail?r=22fd0c4f58c1 ***

runtime: parallelize garbage collector mark + sweep

Running test/garbage/parser.out.

On a 4-core Lenovo X201s (Linux):
31.12u 0.60s 31.74r 	 1 cpu, no atomics
32.27u 0.58s 32.86r 	 1 cpu, atomic instructions
33.04u 0.83s 27.47r 	 2 cpu

On a 16-core Xeon (Linux):
33.08u 0.65s 33.80r 	 1 cpu, no atomics
34.87u 1.12s 29.60r 	 2 cpu
36.00u 1.87s 28.43r 	 3 cpu
36.46u 2.34s 27.10r 	 4 cpu
38.28u 3.85s 26.92r 	 5 cpu
37.72u 5.25s 26.73r	 6 cpu
39.63u 7.11s 26.95r	 7 cpu
39.67u 8.10s 26.68r	 8 cpu

On a 2-core MacBook Pro Core 2 Duo 2.26 (circa 2009, MacBookPro5,5):
39.43u 1.45s 41.27r 	 1 cpu, no atomics
43.98u 2.95s 38.69r 	 2 cpu

On a 2-core Mac Mini Core 2 Duo 1.83 (circa 2008; Macmini2,1):
48.81u 2.12s 51.76r 	 1 cpu, no atomics
57.15u 4.72s 51.54r 	 2 cpu

The handoff algorithm is really only good for two cores.
Beyond that we will need to so something more sophisticated,
like have each core hand off to the next one, around a circle.
Even so, the code is a good checkpoint; for now we'll limit the
number of gc procs to at most 2.

R=dvyukov
CC=golang-dev
http://codereview.appspot.com/4641082
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b