]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: refactor finalizer goroutine status
authorLeonard Wang <wangdeyu0907@gmail.com>
Wed, 13 Apr 2022 13:14:22 +0000 (21:14 +0800)
committerDaniel Martí <mvdan@mvdan.cc>
Mon, 5 Sep 2022 08:28:34 +0000 (08:28 +0000)
commitbd5595d7fa4eb3e234aabeac554f2ba8f2a95790
tree5f1e4bc7f0e801e11b3698d199e1c4eb4fd9f7ff
parent67e6542467321099c0ffcf77ee660e28ec211588
runtime: refactor finalizer goroutine status

Use an atomic.Uint32 to represent the state of finalizer goroutine.
fingStatus will only be changed to fingWake in non fingWait state,
so it is safe to set fingRunningFinalizer status in runfinq.

name            old time/op  new time/op  delta
Finalizer-8      592µs ± 4%   561µs ± 1%  -5.22%  (p=0.000 n=10+10)
FinalizerRun-8   694ns ± 6%   675ns ± 7%    ~     (p=0.059 n=9+8)

Change-Id: I7e4da30cec98ce99f7d8cf4c97f933a8a2d1cae1
Reviewed-on: https://go-review.googlesource.com/c/go/+/400134
Reviewed-by: Joedian Reid <joedian@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/export_test.go
src/runtime/mfinal.go
src/runtime/mprof.go
src/runtime/proc.go
src/runtime/traceback.go