]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: eliminate false sharing during stack growth
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 12 Jul 2011 17:56:21 +0000 (10:56 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 12 Jul 2011 17:56:21 +0000 (10:56 -0700)
Remove static variable from runtime·oldstack().
Benchmark results on HP Z600 (2 x Xeon E5620, 8 HT cores, 2.40GHz)
are as follows (with CL 4657091 applied):
benchmark                                        old ns/op    new ns/op    delta
BenchmarkStackGrowth                               1183.00      1180.00   -0.25%
BenchmarkStackGrowth-2                             1249.00      1211.00   -3.04%
BenchmarkStackGrowth-4                              954.00       805.00  -15.62%
BenchmarkStackGrowth-8                              701.00       683.00   -2.57%
BenchmarkStackGrowth-16                             465.00       415.00  -10.75%

R=rsc
CC=golang-dev
https://golang.org/cl/4693042

src/pkg/runtime/proc.c

index 133203a3ac4f550ad61ada9a0a81b68df5eed135..17397ca821c1ada6744fd26187c03e7f2fb1c04a 100644 (file)
@@ -709,7 +709,7 @@ runtime·oldstack(void)
        uint32 argsize;
        byte *sp;
        G *g1;
-       static int32 goid;
+       int32 goid;
 
 //printf("oldstack m->cret=%p\n", m->cret);
 
@@ -723,6 +723,7 @@ runtime·oldstack(void)
                runtime·mcpy(top->argp, sp, argsize);
        }
        goid = old.gobuf.g->goid;       // fault if g is bad, before gogo
+       USED(goid);
 
        if(old.free != 0)
                runtime·stackfree(g1->stackguard - StackGuard, old.free);