From 259d60995d735523fc25939c35847538eb0d0670 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Mon, 24 Apr 2017 17:26:41 +0300 Subject: [PATCH] runtime: align mcentral by cache line size This may improve perormance during concurrent access to mheap.central array from multiple CPU cores. Change-Id: I8f48dd2e72aa62e9c32de07ae60fe552d8642782 Reviewed-on: https://go-review.googlesource.com/41550 Reviewed-by: Austin Clements Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/runtime/mheap.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index c2d5b46223..82dc599b97 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -121,7 +121,7 @@ type mheap struct { // gets its own cache line. central [_NumSizeClasses]struct { mcentral mcentral - pad [sys.CacheLineSize]byte + pad [sys.CacheLineSize - unsafe.Sizeof(mcentral{})%sys.CacheLineSize]byte } spanalloc fixalloc // allocator for span* -- 2.48.1