]> Cypherpunks repositories - gostls13.git/commitdiff
undo CL 7310096 / 59da6744d66d
authorRuss Cox <rsc@golang.org>
Fri, 15 Feb 2013 22:54:46 +0000 (17:54 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 15 Feb 2013 22:54:46 +0000 (17:54 -0500)
broke windows build

««« original CL description
runtime: ensure forward progress of runtime.Gosched() for locked goroutines
The removed code leads to the situation when M executes the same locked G again and again.
Fixes #4820.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7310096
»»»

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/7343050

src/pkg/runtime/proc.c
src/pkg/runtime/proc_test.go

index 5c60cddf9babb0fbe1e54e3f16b0766f5c842c97..f8ddf9b47e5dd0fe79e752c091a85435611dc66d 100644 (file)
@@ -397,6 +397,14 @@ canaddmcpu(void)
 static void
 gput(G *gp)
 {
+       M *mp;
+
+       // If g is wired, hand it off directly.
+       if((mp = gp->lockedm) != nil && canaddmcpu()) {
+               mnextg(mp, gp);
+               return;
+       }
+
        // If g is the idle goroutine for an m, hand it off.
        if(gp->idlem != nil) {
                if(gp->idlem->idleg != nil) {
index b68599a4961c667365c4f20187bb49ae313c945c..927bd7b816a7d36706c3f3176b18560fcff40ca8 100644 (file)
@@ -46,36 +46,6 @@ func TestStopTheWorldDeadlock(t *testing.T) {
        runtime.GOMAXPROCS(maxprocs)
 }
 
-func TestYieldProgress(t *testing.T) {
-       testYieldProgress(t, false)
-}
-
-func TestYieldLockedProgress(t *testing.T) {
-       testYieldProgress(t, true)
-}
-
-func testYieldProgress(t *testing.T, locked bool) {
-       c := make(chan bool)
-       cack := make(chan bool)
-       go func() {
-               if locked {
-                       runtime.LockOSThread()
-               }
-               for {
-                       select {
-                       case <-c:
-                               cack <- true
-                               break
-                       default:
-                               runtime.Gosched()
-                       }
-               }
-       }()
-       time.Sleep(10 * time.Millisecond)
-       c <- true
-       <-cack
-}
-
 func TestYieldLocked(t *testing.T) {
        const N = 10
        c := make(chan bool)