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

Issue 104200047: code review 104200047: runtime: stack allocator, separate from mallocgc (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
9 years, 10 months ago by khr
Modified:
9 years, 9 months ago
Reviewers:
gobot, rsc, dave, dvyukov
CC:
golang-codereviews, khr1, rsc
Visibility:
Public.

Description

runtime: stack allocator, separate from mallocgc In order to move malloc to Go, we need to have a separate stack allocator. If we run out of stack during malloc, malloc will not be available to allocate a new stack. Stacks are the last remaining FlagNoGC objects in the GC heap. Once they are out, we can get rid of the distinction between the allocated/blockboundary bits. (This will be in a separate change.) Fixes issue 7468 Fixes issue 7424

Patch Set 1 #

Patch Set 2 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 3 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 4 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 5 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 6 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Total comments: 19

Patch Set 7 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Total comments: 1

Patch Set 8 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Total comments: 3

Patch Set 9 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Total comments: 3

Patch Set 10 : diff -r 7d2e78c502ab https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 11 : diff -r 1fcd603852b0 https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 12 : diff -r 1fcd603852b0 https://khr%40golang.org@code.google.com/p/go/ #

Patch Set 13 : diff -r 26db394e3aca https://khr%40golang.org@code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+487 lines, -297 lines) Patch
M src/pkg/runtime/malloc.h View 1 2 3 4 5 6 7 8 9 8 chunks +23 lines, -4 lines 0 comments Download
M src/pkg/runtime/mcache.c View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/pkg/runtime/mcentral.c View 1 2 3 4 5 6 7 1 chunk +2 lines, -0 lines 0 comments Download
M src/pkg/runtime/mem.go View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/runtime/mgc0.c View 1 2 3 4 5 6 7 8 9 10 5 chunks +10 lines, -6 lines 0 comments Download
M src/pkg/runtime/mheap.c View 1 2 3 4 5 6 7 8 9 10 11 15 chunks +185 lines, -138 lines 0 comments Download
M src/pkg/runtime/proc.c View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -1 line 0 comments Download
M src/pkg/runtime/runtime.h View 1 2 3 4 5 6 7 8 9 10 5 chunks +3 lines, -12 lines 0 comments Download
M src/pkg/runtime/stack.c View 1 2 3 4 5 6 7 8 9 10 9 chunks +211 lines, -135 lines 0 comments Download
M src/pkg/runtime/stack_test.go View 1 2 3 4 5 6 1 chunk +49 lines, -0 lines 0 comments Download

Messages

Total messages: 26
khr
Hello golang-codereviews@googlegroups.com, I'd like you to review this change to https://khr%40golang.org@code.google.com/p/go/
9 years, 10 months ago (2014-06-20 00:04:42 UTC) #1
dvyukov
https://codereview.appspot.com/104200047/diff/90001/src/pkg/runtime/malloc.h File src/pkg/runtime/malloc.h (right): https://codereview.appspot.com/104200047/diff/90001/src/pkg/runtime/malloc.h#newcode257 src/pkg/runtime/malloc.h:257: uint64 stacks_sys; // always 0 you actually set it ...
9 years, 10 months ago (2014-06-20 03:51:06 UTC) #2
khr1
On Thu, Jun 19, 2014 at 8:51 PM, <dvyukov@google.com> wrote: > > https://codereview.appspot.com/104200047/diff/90001/src/ > pkg/runtime/malloc.h ...
9 years, 10 months ago (2014-06-20 04:50:29 UTC) #3
dvyukov
On Thu, Jun 19, 2014 at 9:50 PM, Keith Randall <khr@google.com> wrote: https://codereview.appspot.com/104200047/diff/90001/src/pkg/runtime/stack.c#newcode187 >> src/pkg/runtime/stack.c:187: ...
9 years, 10 months ago (2014-06-20 05:04:08 UTC) #4
dave_cheney.net
https://codereview.appspot.com/104200047/diff/110001/src/pkg/runtime/mcentral.c File src/pkg/runtime/mcentral.c (right): https://codereview.appspot.com/104200047/diff/110001/src/pkg/runtime/mcentral.c#newcode267 src/pkg/runtime/mcentral.c:267: runtime·throw("still in list"); could you make the message a ...
9 years, 10 months ago (2014-06-20 10:28:59 UTC) #5
dvyukov
does it fix https://code.google.com/p/go/issues/detail?id=7468 ? stack and heap seems to be clearly separated with this ...
9 years, 10 months ago (2014-06-21 17:58:27 UTC) #6
dvyukov
also seem to fix https://code.google.com/p/go/issues/detail?id=7424
9 years, 10 months ago (2014-06-21 23:08:53 UTC) #7
khr1
Yes, it should fix both of those. Assuming I can get this exitsyscall thing ironed ...
9 years, 10 months ago (2014-06-22 02:51:34 UTC) #8
khr1
PTAL. I added a case for when m->mcache is nil, so I don't need the ...
9 years, 10 months ago (2014-06-24 14:32:53 UTC) #9
dvyukov
https://codereview.appspot.com/104200047/diff/130001/src/pkg/runtime/asm_amd64.s File src/pkg/runtime/asm_amd64.s (right): https://codereview.appspot.com/104200047/diff/130001/src/pkg/runtime/asm_amd64.s#newcode91 src/pkg/runtime/asm_amd64.s:91: CALL runtime·stackinit(SB) move this to runtime.schedinit we already call ...
9 years, 10 months ago (2014-06-25 05:04:54 UTC) #10
khr1
On Tue, Jun 24, 2014 at 10:04 PM, <dvyukov@google.com> wrote: > > https://codereview.appspot.com/104200047/diff/130001/src/ > pkg/runtime/asm_amd64.s ...
9 years, 10 months ago (2014-06-27 02:44:31 UTC) #11
rsc
LGTM https://codereview.appspot.com/104200047/diff/150001/src/pkg/runtime/malloc.h File src/pkg/runtime/malloc.h (right): https://codereview.appspot.com/104200047/diff/150001/src/pkg/runtime/malloc.h#newcode119 src/pkg/runtime/malloc.h:119: // Per-P, per order stack segment cache size. ...
9 years, 10 months ago (2014-06-27 16:42:51 UTC) #12
dvyukov
LGTM if you fix the issue below https://codereview.appspot.com/104200047/diff/150001/src/pkg/runtime/proc.c File src/pkg/runtime/proc.c (right): https://codereview.appspot.com/104200047/diff/150001/src/pkg/runtime/proc.c#newcode1846 src/pkg/runtime/proc.c:1846: newg = ...
9 years, 10 months ago (2014-06-28 01:13:37 UTC) #13
khr1
On Fri, Jun 27, 2014 at 9:42 AM, <rsc@golang.org> wrote: > LGTM > > > ...
9 years, 10 months ago (2014-06-29 02:16:23 UTC) #14
rsc
sure, that's fine
9 years, 10 months ago (2014-06-30 15:22:07 UTC) #15
khr
*** Submitted as https://code.google.com/p/go/source/detail?r=318b04f28372 *** runtime: stack allocator, separate from mallocgc In order to move ...
9 years, 10 months ago (2014-07-01 01:59:33 UTC) #16
gobot
This CL appears to have broken the plan9-386-cnielsen builder. See http://build.golang.org/log/670207943c0b427f835d82757f438e11fbcf6700
9 years, 10 months ago (2014-07-01 02:02:28 UTC) #17
dave_cheney.net
This CL has broken all the windows builders and all the race builders, please consider ...
9 years, 10 months ago (2014-07-01 02:22:12 UTC) #18
dvyukov
This change also increased RSS on garbage-8 from 1.1GB to 1.5GB (+25%): http://goperfd.appspot.com/perfdetail?commit=318b04f28372345dc41cdd79fe86f12921f0c60d&commit0=26db394e3aca97c30ede13804fdd411825610770&kind=builder&builder=linux-amd64&benchmark=garbage Looks like ...
9 years, 10 months ago (2014-07-01 06:06:29 UTC) #19
dvyukov
Keith, do you have any progress on this? I would like this to be submitted ...
9 years, 9 months ago (2014-07-16 19:36:24 UTC) #20
khr1
I'm still working on fixing the Windows bug. Hopefully really soon. On Wed, Jul 16, ...
9 years, 9 months ago (2014-07-16 20:02:56 UTC) #21
dvyukov
On Tue, Jul 1, 2014 at 10:06 AM, <dvyukov@google.com> wrote: > This change also increased ...
9 years, 9 months ago (2014-07-16 20:25:01 UTC) #22
khr1
I found a memory leak and fixed it. I haven't tested post-fix though. Hopefully that ...
9 years, 9 months ago (2014-07-16 21:04:14 UTC) #23
khr1
By the way, how do I reproduce the RSS size measurements you mentioned? On Wed, ...
9 years, 9 months ago (2014-07-17 04:09:18 UTC) #24
dave_cheney.net
I think it is via the go perf dashboard. You could try running a perf ...
9 years, 9 months ago (2014-07-17 04:15:08 UTC) #25
dvyukov
9 years, 9 months ago (2014-07-17 04:36:13 UTC) #26
go get code.google.com/p/go.benchmarks
cd $GOPATH/src/code.google.com/p/go.benchmarks
go build -o bench0 ./bench/bench.go
GOMAXPROCS=8 ./bench0 -bench=garbage -benchmem=1024 -benchtime=5s -benchnum=3



On Thu, Jul 17, 2014 at 8:09 AM, Keith Randall <khr@google.com> wrote:
> By the way, how do I reproduce the RSS size measurements you mentioned?
>
>
>
> On Wed, Jul 16, 2014 at 2:04 PM, Keith Randall <khr@google.com> wrote:
>>
>> I found a memory leak and fixed it.  I haven't tested post-fix though.
>> Hopefully that was the only leak.
>>
>>
>> On Wed, Jul 16, 2014 at 1:24 PM, Dmitry Vyukov <dvyukov@google.com> wrote:
>>>
>>> On Tue, Jul 1, 2014 at 10:06 AM,  <dvyukov@google.com> wrote:
>>> > This change also increased RSS on garbage-8 from 1.1GB to 1.5GB (+25%):
>>> >
>>> >
http://goperfd.appspot.com/perfdetail?commit=318b04f28372345dc41cdd79fe86f129...
>>> > Looks like a quite serious degradation.
>>>
>>> This can be caused by a memory leak, it's easy to test by running the
>>> benchmark for a longer time. Or by the fact that stacks are somehow
>>> accounted against next_gc, which adds same amount of garbage to the
>>> heap. It's unclear how they must be accounted, because during GC we
>>> compact stacks and potentially recover memory; so they must produce
>>> some GC pressure.
>>
>>
>
Sign in to reply to this message.

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