]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: only increment extraMInUse when actually in use
authorMichael Pratt <mpratt@google.com>
Wed, 31 May 2023 18:45:30 +0000 (14:45 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 1 Jun 2023 14:05:01 +0000 (14:05 +0000)
commit7911f7c21d4bba89eee0eab857d089b7ed6232d4
treedfe2403ede32d9e1abf2211a2fca32f33aa4cfc2
parent65dcddeb4e80b9a23ec6fc0157ecab388ba2f34f
runtime: only increment extraMInUse when actually in use

Currently lockextra always increments extraMInUse, even if the M won't
be used (or doesn't even exist), such as in addExtraM. addExtraM fails
to decrement extraMInUse, so it stays elevated forever.

Fix this bug and simplify the model by moving extraMInUse out of
lockextra to getExtraM, where we know the M will actually be used.

While we're here, remove the nilokay argument from getExtraM, which is
always false.

Fixes #60540.

Change-Id: I7a5d97456b3bc6ea1baeb06b5b2975e3b8dd96a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/499677
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/runtime/proc.go
src/runtime/testdata/testprogcgo/callback.go