• Russ Cox's avatar
    runtime: fix a few GC-related bugs · aae0f074
    Russ Cox authored
    1) Move non-preemption check even earlier in newstack.
    This avoids a few priority inversion problems.
    
    2) Always use atomic operations to update bitmap for 1-word objects.
    This avoids lost mark bits during concurrent GC.
    
    3) Stop using work.nproc == 1 as a signal for being single-threaded.
    The concurrent GC runs with work.nproc == 1 but other procs are
    running mutator code.
    
    The use of work.nproc == 1 in getfull *is* safe, but remove it anyway,
    since it is saving only a single atomic operation per GC round.
    
    Fixes #9225.
    
    Change-Id: I24134f100ad592ea8cb59efb6a54f5a1311093dc
    Reviewed-on: https://go-review.googlesource.com/2745Reviewed-by: default avatarRick Hudson <rlh@golang.org>
    aae0f074
malloc.go 31.5 KB