Commit
c257dfb attempted to fix recursive allocation in gcAssistAlloc;
however, it only reduced it: setting gp.gcalloc to 0 isn't sufficient
to disable assists at the beginning of the GC cycle when gp.gcscanwork
is also small or zero.
Fix this recursion more completely by setting gcalloc to a sentinel
value that directly disables assists.
Fixes #12894 (again).
Change-Id: I9599566222d8f540d0b39806846bfc702e6666e5
Reviewed-on: https://go-review.googlesource.com/15891
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
}
// Record allocation.
+ if gp.gcalloc+size < gp.gcalloc {
+ // gcalloc would overflow, or it's set to a sentinel
+ // value to prevent recursive assist.
+ return
+ }
gp.gcalloc += size
if !allowAssist {
// timeSleep may allocate, so avoid recursive assist.
gcalloc := gp.gcalloc
- gp.gcalloc = 0
+ gp.gcalloc = ^uintptr(0)
timeSleep(100 * 1000)
gp.gcalloc = gcalloc
goto retry