1
0
mirror of https://github.com/golang/go synced 2024-11-19 06:34:42 -07:00

runtime: mark with non-atomic operations when GOMAXPROCS=1

Perf builders show 3-5% GC pause increase with GOMAXPROCS=1 when marking with atomic ops:
http://goperfd.appspot.com/perfdetail?commit=a8a6e765d6a87f7ccb71fd85a60eb5a821151f85&commit0=3b864e02b987171e05e2e9d0840b85b5b6476386&kind=builder&builder=linux-amd64&benchmark=http

LGTM=rlh
R=golang-codereviews, rlh
CC=dave, golang-codereviews, khr, rsc
https://golang.org/cl/128340043
This commit is contained in:
Dmitriy Vyukov 2014-08-16 09:07:55 +04:00
parent 78cc89ce67
commit c6fe53a230

View File

@ -451,7 +451,8 @@ scanblock(byte *b, uintptr n, byte *ptrmask)
// quadruple is already marked. Otherwise we resort to CAS // quadruple is already marked. Otherwise we resort to CAS
// loop for marking. // loop for marking.
bits8 = xbits>>(shift&~7); bits8 = xbits>>(shift&~7);
if((bits8&(bitMask|(bitMask<<gcBits))) != (bitBoundary|(bitBoundary<<gcBits))) if((bits8&(bitMask|(bitMask<<gcBits))) != (bitBoundary|(bitBoundary<<gcBits)) ||
work.nproc == 1)
((uint8*)bitp)[shift/8] = bits8 | (bitMarked<<(shift&7)); ((uint8*)bitp)[shift/8] = bits8 | (bitMarked<<(shift&7));
else { else {
for(;;) { for(;;) {