diff options
| author | Austin Clements <austin@google.com> | 2018-09-11 11:28:24 -0400 |
|---|---|---|
| committer | Austin Clements <austin@google.com> | 2018-10-02 20:35:29 +0000 |
| commit | 6e9fb11b3a314b78f9c2cdb35e3d71a5cce4e06b (patch) | |
| tree | 638cfc2deb2d86738a57a9db8678ac100598c1d0 /src/runtime/runtime2.go | |
| parent | 29b21ec4c371061a99dfaac356e54b3c62c5853f (diff) | |
| download | go-6e9fb11b3a314b78f9c2cdb35e3d71a5cce4e06b.tar.xz | |
runtime: support disabling goroutine scheduling by class
This adds support for disabling the scheduling of user goroutines
while allowing system goroutines like the garbage collector to
continue running. User goroutines pass through the usual state
transitions, but if we attempt to actually schedule one, it will get
put on a deferred scheduling list.
Updates #26903. This is preparation for unifying STW GC and concurrent
GC.
Updates #25578. This same mechanism can form the basis for disabling
all but a single user goroutine for the purposes of debugger function
call injection.
Change-Id: Ib72a808e00c25613fe6982f5528160d3de3dbbc6
Reviewed-on: https://go-review.googlesource.com/c/134779
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/runtime2.go')
| -rw-r--r-- | src/runtime/runtime2.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go index 259bb376ae..fbca3d3ba6 100644 --- a/src/runtime/runtime2.go +++ b/src/runtime/runtime2.go @@ -580,6 +580,18 @@ type schedt struct { runq gQueue runqsize int32 + // disable controls selective disabling of the scheduler. + // + // Use schedEnableUser to control this. + // + // disable is protected by sched.lock. + disable struct { + // user disables scheduling of user goroutines. + user bool + runnable gQueue // pending runnable Gs + n int32 // length of runnable + } + // Global cache of dead G's. gFree struct { lock mutex |
