mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: do not split stacks in syscall status
Split stack checks (morestack) corrupt g->sched, but g->sched must be preserved consistent for GC/traceback. The change implements runtime.notetsleepg function, which does entersyscall/exitsyscall and is carefully arranged to not call any split functions in between. R=rsc CC=golang-dev https://golang.org/cl/11575044
This commit is contained in:
parent
b8734748b6
commit
e84d9e1fb3
17 changed files with 290 additions and 185 deletions
|
|
@ -246,6 +246,8 @@ runtime·newstack(void)
|
|||
runtime·throw("runtime: preempt g0");
|
||||
if(oldstatus == Grunning && m->p == nil)
|
||||
runtime·throw("runtime: g is running but p is not");
|
||||
if(oldstatus == Gsyscall && m->locks == 0)
|
||||
runtime·throw("runtime: stack split during syscall");
|
||||
// Be conservative about where we preempt.
|
||||
// We are interested in preempting user Go code, not runtime code.
|
||||
if(oldstatus != Grunning || m->locks || m->mallocing || m->gcing || m->p->status != Prunning) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue