aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/malloc.h
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-08-06 01:50:37 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-08-06 01:50:37 +0400
commitf6f2f77142fcf0a4ec317bff6850ffb6ee6f0bb2 (patch)
treeb56dd602fe37ab281e8739cca8295038ba5c1d60 /src/pkg/runtime/malloc.h
parent22e08d1a3b6fba51df3bcad9a5f0d70fefd0412d (diff)
downloadgo-f6f2f77142fcf0a4ec317bff6850ffb6ee6f0bb2.tar.xz
runtime: cache one GC workbuf in thread-local storage
We call scanblock for lots of small root pieces e.g. for every stack frame args and locals area. Every scanblock invocation calls getempty/putempty, which accesses lock-free stack shared among all worker threads. One-element local cache allows most scanblock calls to proceed without accessing the shared stack. LGTM=rsc R=golang-codereviews, rlh CC=golang-codereviews, khr, rsc https://golang.org/cl/121250043
Diffstat (limited to 'src/pkg/runtime/malloc.h')
-rw-r--r--src/pkg/runtime/malloc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pkg/runtime/malloc.h b/src/pkg/runtime/malloc.h
index 958c540361..810d4ac402 100644
--- a/src/pkg/runtime/malloc.h
+++ b/src/pkg/runtime/malloc.h
@@ -334,6 +334,8 @@ struct MCache
StackFreeList stackcache[NumStackOrders];
+ void* gcworkbuf;
+
// Local allocator stats, flushed during GC.
uintptr local_nlookup; // number of pointer lookups
uintptr local_largefree; // bytes freed for large objects (>MaxSmallSize)
@@ -344,6 +346,7 @@ struct MCache
MSpan* runtime·MCache_Refill(MCache *c, int32 sizeclass);
void runtime·MCache_ReleaseAll(MCache *c);
void runtime·stackcache_clear(MCache *c);
+void runtime·gcworkbuffree(void *b);
enum
{