code review 9665046: runtime: update comment on stack allocator (issue 9665046)

35 views
Skip to first unread message

dvy...@google.com

unread,
May 25, 2013, 1:47:24 PM5/25/13
to golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
Reviewers: golang-dev1,

Message:
Hello golan...@googlegroups.com,

I'd like you to review this change to
https://dvyukov%40goog...@code.google.com/p/go/


Description:
runtime: update comment on stack allocator

Please review this at https://codereview.appspot.com/9665046/

Affected files:
M src/pkg/runtime/stack.c


Index: src/pkg/runtime/stack.c
===================================================================
--- a/src/pkg/runtime/stack.c
+++ b/src/pkg/runtime/stack.c
@@ -81,13 +81,10 @@
if(g != m->g0)
runtime·throw("stackalloc not on scheduler stack");

- // Stack allocator uses malloc/free most of the time,
- // but if we're in the middle of malloc and need stack,
- // we have to do something else to avoid deadlock.
- // In that case, we fall back on a fixed-size free-list
- // allocator, assuming that inside malloc all the stack
- // frames are small, so that all the stack allocations
- // will be a single size, the minimum (right now, 5k).
+ // Stack allocator uses fixed-size free-list allocator most of the time.
+ // But if we need a stack of a non-standard size, we fall back on malloc
+ // (assuming that inside malloc and GC all the stack frames are small,
+ // so that we do not deadlock).
if(n == FixedStack || m->mallocing || m->gcing) {
if(n != FixedStack) {
runtime·printf("stackalloc: in malloc, size=%d want %d\n", FixedStack,
n);


r...@golang.org

unread,
May 25, 2013, 2:29:46 PM5/25/13
to dvy...@google.com, golan...@googlegroups.com, re...@codereview-hr.appspotmail.com
LGTM, just a little englishtweakingness


https://codereview.appspot.com/9665046/diff/5001/src/pkg/runtime/stack.c
File src/pkg/runtime/stack.c (right):

https://codereview.appspot.com/9665046/diff/5001/src/pkg/runtime/stack.c#newcode87
src/pkg/runtime/stack.c:87: // so that we do not deadlock).
Stacks are usually allocated with a fixed-size free-list allocator, but
if we need a stack of non-standard...

https://codereview.appspot.com/9665046/

dvy...@google.com

unread,
May 25, 2013, 2:47:46 PM5/25/13
to dvy...@google.com, golan...@googlegroups.com, r...@golang.org, re...@codereview-hr.appspotmail.com
*** Submitted as
https://code.google.com/p/go/source/detail?r=ca166884c853 ***

runtime: update comment on stack allocator

R=golang-dev, r
CC=golang-dev
https://codereview.appspot.com/9665046
On 2013/05/25 18:29:46, r wrote:
> Stacks are usually allocated with a fixed-size free-list allocator,
but if we
> need a stack of non-standard...

Done.

https://codereview.appspot.com/9665046/

dvy...@google.com

unread,
May 25, 2013, 2:48:07 PM5/25/13
to dvy...@google.com, golan...@googlegroups.com, r...@golang.org, re...@codereview-hr.appspotmail.com

dvy...@google.com

unread,
May 25, 2013, 2:48:41 PM5/25/13
to dvy...@google.com, golan...@googlegroups.com, r...@golang.org, re...@codereview-hr.appspotmail.com
On 2013/05/25 18:47:46, dvyukov wrote:
> On 2013/05/25 18:29:46, r wrote:
> > Stacks are usually allocated with a fixed-size free-list allocator,
but if we
> > need a stack of non-standard...

> Done.

Done.

https://codereview.appspot.com/9665046/
Reply all
Reply to author
Forward
0 new messages