]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove atomic CAS loop from marknogc
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 11 Mar 2014 13:35:49 +0000 (17:35 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Tue, 11 Mar 2014 13:35:49 +0000 (17:35 +0400)
Spans are now private to threads, and the loop
is removed from all other functions.
Remove it from marknogc for consistency.

LGTM=khr, rsc
R=golang-codereviews, bradfitz, khr
CC=golang-codereviews, khr, rsc
https://golang.org/cl/72520043

src/pkg/runtime/mgc0.c

index 3c744178938f12b7ca68e52ff1f3c445a9f2aa28..0bb2badde553300f597ccac2717e80eb3c205da8 100644 (file)
@@ -2614,26 +2614,12 @@ runfinq(void)
 void
 runtime·marknogc(void *v)
 {
-       uintptr *b, obits, bits, off, shift;
+       uintptr *b, off, shift;
 
        off = (uintptr*)v - (uintptr*)runtime·mheap.arena_start;  // word offset
        b = (uintptr*)runtime·mheap.arena_start - off/wordsPerBitmapWord - 1;
        shift = off % wordsPerBitmapWord;
-
-       for(;;) {
-               obits = *b;
-               if((obits>>shift & bitMask) != bitAllocated)
-                       runtime·throw("bad initial state for marknogc");
-               bits = (obits & ~(bitAllocated<<shift)) | bitBlockBoundary<<shift;
-               if(runtime·gomaxprocs == 1) {
-                       *b = bits;
-                       break;
-               } else {
-                       // more than one goroutine is potentially running: use atomic op
-                       if(runtime·casp((void**)b, (void*)obits, (void*)bits))
-                               break;
-               }
-       }
+       *b = (*b & ~(bitAllocated<<shift)) | bitBlockBoundary<<shift;
 }
 
 void