diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2013-07-31 20:03:05 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2013-07-31 20:03:05 +0400 |
| commit | 6ee69a97269eb26186d08832dcafd9432945f5ad (patch) | |
| tree | afdb474a216d4a971b1d185c8e0394e75ea5aefc /src/pkg/runtime/proc.c | |
| parent | 8679d5f2b5a621099af285587601d9f0c3f9b93b (diff) | |
| download | go-6ee69a97269eb26186d08832dcafd9432945f5ad.tar.xz | |
undo CL 12167043 / 475e11851fc1
Submitted with some unrelated changes that were not intended to go in.
««« original CL description
runtime: do not park sysmon thread if any goroutines are running
Sysmon thread parks if no goroutines are running (runtime.sched.npidle == runtime.gomaxprocs).
Currently it's unparked when a goroutine enters syscall, it was enough
to retake P's from blocking syscalls.
But it's not enough for reliable goroutine preemption. We need to ensure that
sysmon runs if any goroutines are running.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/12167043
»»»
R=rsc
CC=golang-dev
https://golang.org/cl/12171044
Diffstat (limited to 'src/pkg/runtime/proc.c')
| -rw-r--r-- | src/pkg/runtime/proc.c | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index f333fdd877..c4b8c02517 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -1536,10 +1536,6 @@ exitsyscallfast(void) if(runtime·sched.pidle) { runtime·lock(&runtime·sched); p = pidleget(); - if(p && runtime·atomicload(&runtime·sched.sysmonwait)) { - runtime·atomicstore(&runtime·sched.sysmonwait, 0); - runtime·notewakeup(&runtime·sched.sysmonnote); - } runtime·unlock(&runtime·sched); if(p) { acquirep(p); @@ -1563,10 +1559,6 @@ exitsyscall0(G *gp) p = pidleget(); if(p == nil) globrunqput(gp); - else if(runtime·atomicload(&runtime·sched.sysmonwait)) { - runtime·atomicstore(&runtime·sched.sysmonwait, 0); - runtime·notewakeup(&runtime·sched.sysmonnote); - } runtime·unlock(&runtime·sched); if(p) { acquirep(p); @@ -1932,38 +1924,24 @@ static struct { uintptr pcbuf[100]; } prof; -static void -System(void) -{ -} - // Called if we receive a SIGPROF signal. void runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp) { int32 n; - bool traceback; - if(prof.fn == nil || prof.hz == 0) - return; - traceback = true; // Windows does profiling in a dedicated thread w/o m. if(!Windows && (m == nil || m->mcache == nil)) - traceback = false; - if(gp == m->g0 || gp == m->gsignal) - traceback = false; - if(m != nil && m->racecall) - traceback = false; + return; + if(prof.fn == nil || prof.hz == 0) + return; runtime·lock(&prof); if(prof.fn == nil) { runtime·unlock(&prof); return; } - n = 1; - prof.pcbuf[0] = (uintptr)pc; - if(traceback) - n = runtime·gentraceback((uintptr)pc, (uintptr)sp, (uintptr)lr, gp, 0, prof.pcbuf, nelem(prof.pcbuf), nil, nil, false); + n = runtime·gentraceback((uintptr)pc, (uintptr)sp, (uintptr)lr, gp, 0, prof.pcbuf, nelem(prof.pcbuf), nil, nil, false); if(n > 0) prof.fn(prof.pcbuf, n); runtime·unlock(&prof); |
