diff options
| author | Cherry Zhang <cherryyz@google.com> | 2016-11-14 18:24:37 -0500 |
|---|---|---|
| committer | Cherry Zhang <cherryyz@google.com> | 2016-11-21 20:25:17 +0000 |
| commit | bbe96f5673fbb379ec3da581dba0d9cd603cc0d1 (patch) | |
| tree | f795d2e3a11e4d6ff0261e0e8be206d5a20359c3 /src | |
| parent | ccd69d058278ef97dfd9b122d3832ec027455e90 (diff) | |
| download | go-bbe96f5673fbb379ec3da581dba0d9cd603cc0d1.tar.xz | |
runtime: make work.bytesMarked 8-byte aligned
Make atomic access on 32-bit architectures happy.
Updates #17786.
Change-Id: I42de63ff1381af42124dc51befc887160f71797d
Reviewed-on: https://go-review.googlesource.com/33235
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Austin Clements <austin@google.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/runtime/mgc.go | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index f97b589839..cc79d4cfff 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -781,6 +781,22 @@ var work struct { empty uint64 // lock-free list of empty blocks workbuf pad0 [sys.CacheLineSize]uint8 // prevents false-sharing between full/empty and nproc/nwait + // bytesMarked is the number of bytes marked this cycle. This + // includes bytes blackened in scanned objects, noscan objects + // that go straight to black, and permagrey objects scanned by + // markroot during the concurrent scan phase. This is updated + // atomically during the cycle. Updates may be batched + // arbitrarily, since the value is only read at the end of the + // cycle. + // + // Because of benign races during marking, this number may not + // be the exact number of marked bytes, but it should be very + // close. + // + // Put this field here because it needs 64-bit atomic access + // (and thus 8-byte alignment even on 32-bit architectures). + bytesMarked uint64 + markrootNext uint32 // next markroot job markrootJobs uint32 // number of markroot jobs @@ -842,19 +858,6 @@ var work struct { // program started if debug.gctrace > 0. totaltime int64 - // bytesMarked is the number of bytes marked this cycle. This - // includes bytes blackened in scanned objects, noscan objects - // that go straight to black, and permagrey objects scanned by - // markroot during the concurrent scan phase. This is updated - // atomically during the cycle. Updates may be batched - // arbitrarily, since the value is only read at the end of the - // cycle. - // - // Because of benign races during marking, this number may not - // be the exact number of marked bytes, but it should be very - // close. - bytesMarked uint64 - // initialHeapLive is the value of memstats.heap_live at the // beginning of this GC cycle. initialHeapLive uint64 |
