diff options
| author | Keith Randall <khr@golang.org> | 2014-02-26 23:28:44 -0800 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2014-02-26 23:28:44 -0800 |
| commit | 1665b006a57099d7bdf5c9f1277784d36b7168d9 (patch) | |
| tree | b580dcbc40283a9ee36d08d65e9588c65b7d313a /src/pkg/runtime/mem_linux.c | |
| parent | e5f01aee04dc6313c85dab78305adf499e1f7bfa (diff) | |
| download | go-1665b006a57099d7bdf5c9f1277784d36b7168d9.tar.xz | |
runtime: grow stack by copying
On stack overflow, if all frames on the stack are
copyable, we copy the frames to a new stack twice
as large as the old one. During GC, if a G is using
less than 1/4 of its stack, copy the stack to a stack
half its size.
TODO
- Do something about C frames. When a C frame is in the
stack segment, it isn't copyable. We allocate a new segment
in this case.
- For idempotent C code, we can abort it, copy the stack,
then retry. I'm working on a separate CL for this.
- For other C code, we can raise the stackguard
to the lowest Go frame so the next call that Go frame
makes triggers a copy, which will then succeed.
- Pick a starting stack size?
The plan is that eventually we reach a point where the
stack contains only copyable frames.
LGTM=rsc
R=dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/54650044
Diffstat (limited to 'src/pkg/runtime/mem_linux.c')
| -rw-r--r-- | src/pkg/runtime/mem_linux.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pkg/runtime/mem_linux.c b/src/pkg/runtime/mem_linux.c index 2786ad70f6..bab05011ff 100644 --- a/src/pkg/runtime/mem_linux.c +++ b/src/pkg/runtime/mem_linux.c @@ -92,6 +92,12 @@ runtime·SysFree(void *v, uintptr n, uint64 *stat) runtime·munmap(v, n); } +void +runtime·SysFault(void *v, uintptr n) +{ + runtime·mmap(v, n, PROT_NONE, 0, -1, 0); +} + void* runtime·SysReserve(void *v, uintptr n) { |
