Commit c6fe53a2 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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
parent 78cc89ce
...@@ -451,7 +451,8 @@ scanblock(byte *b, uintptr n, byte *ptrmask) ...@@ -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(;;) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment