aboutsummaryrefslogtreecommitdiff
path: root/src/strings
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2020-04-28 16:40:38 +0000
committerMichael Knyszek <mknyszek@google.com>2020-04-28 17:42:24 +0000
commit0ddde4ada2b1aa61310db06b20c936160d3e4567 (patch)
tree370ba5973be30fbf40c8d36c5d0adb5cd3dec22a /src/strings
parentbd01a1b756caf9f7a1e86296c3c69ff65c69b734 (diff)
downloadgo-0ddde4ada2b1aa61310db06b20c936160d3e4567.tar.xz
runtime: flush mcaches to mcentral before reading memstats
Currently mcaches are flushed to mcentral after a bunch of memstats have already been read. This is not safe (in the sense that it doesn't ensure consisent memstats) since memstats may in general change when mcentral data structures are manipulated. Note that prior to the new mcentral implementation this was not a problem because mcentral operations happened to never modify certain memstats. As of the new mcentral implementation, we might for example persistentalloc when uncaching a span, which would change memstats. This can cause a skew between the value of sys (which currently is calculated before mcaches are flushed) and the value of gc_sys and other_sys. Fix this by moving mcache flushing to the very top of updatememstats. Also leave a comment explaining that this must be done first, in general, because mcentrals make no guarantee that they will not influence memstats (and doing so would be unnecessarily restrictive). Fixes #38712. Change-Id: I15bacb313c54a46e380a945a71bb75db67169c1b Reviewed-on: https://go-review.googlesource.com/c/go/+/230498 Run-TryBot: Michael Knyszek <mknyszek@google.com> Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/strings')
0 files changed, 0 insertions, 0 deletions