mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
29b21ec4c3
commit
6e9fb11b3a
2 changed files with 73 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue