aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime2.go
diff options
context:
space:
mode:
authorDmitrii Martynov <fkr011288@gmail.com>2025-04-07 17:08:19 +0300
committerGopher Robot <gobot@golang.org>2025-04-15 02:33:12 -0700
commite0dba45c620866bb16cd0db2c51732f03a9b27f3 (patch)
treed8233f69739cb7b23794039b07faa7289b306223 /src/runtime/runtime2.go
parentba7b8ca336123017e43a2ab3310fd4a82122ef9d (diff)
downloadgo-e0dba45c620866bb16cd0db2c51732f03a9b27f3.tar.xz
runtime: size field for gQueue and gList
Before CL, all instances of gQueue and gList stored the size of structures in a separate variable. The size changed manually and passed as a separate argument to different functions. This CL added an additional field to gQueue and gList structures to store the size. Also, the calculation of size was moved into the implementation of API for these structures. This allows to reduce possible errors by eliminating manual calculation of the size and simplifying functions' signatures. Change-Id: I087da2dfaec4925e4254ad40fce5ccb4c175ec41 Reviewed-on: https://go-review.googlesource.com/c/go/+/664777 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/runtime2.go')
-rw-r--r--src/runtime/runtime2.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/runtime/runtime2.go b/src/runtime/runtime2.go
index 4318930d9c..e56b45053e 100644
--- a/src/runtime/runtime2.go
+++ b/src/runtime/runtime2.go
@@ -671,10 +671,7 @@ type p struct {
runnext guintptr
// Available G's (status == Gdead)
- gFree struct {
- gList
- n int32
- }
+ gFree gList
sudogcache []*sudog
sudogbuf [128]*sudog
@@ -785,8 +782,7 @@ type schedt struct {
needspinning atomic.Uint32 // See "Delicate dance" comment in proc.go. Boolean. Must hold sched.lock to set to 1.
// Global runnable queue.
- runq gQueue
- runqsize int32
+ runq gQueue
// disable controls selective disabling of the scheduler.
//
@@ -797,7 +793,6 @@ type schedt 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.
@@ -805,7 +800,6 @@ type schedt struct {
lock mutex
stack gList // Gs with stacks
noStack gList // Gs without stacks
- n int32
}
// Central cache of sudog structs.