From: Michael Anthony Knyszek Date: Wed, 16 Sep 2020 17:08:55 +0000 (+0000) Subject: runtime: actually fix locking in BenchmarkMSpanCountAlloc X-Git-Tag: go1.16beta1~1032 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=10dfb1dd3d1d26122cf18f29468ec17eb7222c3f;p=gostls13.git runtime: actually fix locking in BenchmarkMSpanCountAlloc I just submitted CL 255297 which mostly fixed this problem, but totally forgot to actually acquire/release the heap lock. Oops. Updates #41391. Change-Id: I45b42f20a9fc765c4de52476db3654d4bfe9feb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/255298 Trust: Michael Knyszek Run-TryBot: Michael Knyszek Reviewed-by: Keith Randall TryBot-Result: Go Bot --- diff --git a/src/runtime/export_test.go b/src/runtime/export_test.go index e3d6441c18..f2fa11dc98 100644 --- a/src/runtime/export_test.go +++ b/src/runtime/export_test.go @@ -991,7 +991,9 @@ type MSpan mspan func AllocMSpan() *MSpan { var s *mspan systemstack(func() { + lock(&mheap_.lock) s = (*mspan)(mheap_.spanalloc.alloc()) + unlock(&mheap_.lock) }) return (*MSpan)(s) } @@ -999,7 +1001,9 @@ func AllocMSpan() *MSpan { // Free an allocated mspan. func FreeMSpan(s *MSpan) { systemstack(func() { + lock(&mheap_.lock) mheap_.spanalloc.free(unsafe.Pointer(s)) + unlock(&mheap_.lock) }) }