1. 08 Nov, 2019 30 commits
  2. 07 Nov, 2019 10 commits
    • Michael Anthony Knyszek's avatar
      runtime: switch to new page allocator · e6135c27
      Michael Anthony Knyszek authored
      This change flips the oldPageAllocator constant enabling the new page
      allocator in the Go runtime.
      
      Updates #35112.
      
      Change-Id: I7fc8332af9fd0e43ce28dd5ebc1c1ce519ce6d0c
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201765
      Run-TryBot: Michael Knyszek <mknyszek@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      e6135c27
    • Cherry Zhang's avatar
      runtime: disable async preemption on darwin/arm(64) for now · 52d5e76b
      Cherry Zhang authored
      Enabling async preemption on darwin/arm and darwin/arm64 causes
      the builder to fail, e.g.
      https://build.golang.org/log/03f727b8f91b0c75bf54ff508d7d2f00b5cad4bf
      
      Due to the limited resource, I haven't been able to get access on
      those devices to debug. Disable async preemption for now.
      
      Updates #35439.
      
      Change-Id: I5a31ad6962c2bae8e6e9b8303c494610a8a4e50a
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205842Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
      52d5e76b
    • Keith Randall's avatar
      doc: document new math.Fma function · 953cc749
      Keith Randall authored
      This accidentally got committed - please review the whole paragraph
      as if it was new.
      
      Change-Id: I98e1db4670634c6e792d26201ce0cd329a6928b6
      Reviewed-on: https://go-review.googlesource.com/c/go/+/202579Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      953cc749
    • Matthew Dempsky's avatar
      cmd/compile: restore more missing -m=2 escape analysis details · 4cde749f
      Matthew Dempsky authored
      This CL also restores analysis details for (1) expressions that are
      directly heap allocated because of being too large for the stack or
      non-constant in size, and (2) for assignments that we short circuit
      because we flow their address to another escaping object.
      
      No change to normal compilation behavior. Only adds additional Printfs
      guarded by -m=2.
      
      Updates #31489.
      
      Change-Id: I43682195d389398d75ced2054e29d9907bb966e7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/205917
      Run-TryBot: Matthew Dempsky <mdempsky@google.com>
      Reviewed-by: default avatarDavid Chase <drchase@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      4cde749f
    • Cherry Zhang's avatar
      runtime: add async preemption support on MIPS and MIPS64 · a930fede
      Cherry Zhang authored
      This CL adds support of call injection and async preemption on
      MIPS and MIPS64.
      
      Like ARM64, we need to clobber one register (REGTMP) for
      returning from the injected call. Previous CLs have marked code
      sequences that use REGTMP async-nonpreemtible.
      
      It seems on MIPS/MIPS64, a CALL instruction is not "atomic" (!).
      If a signal is delivered right at the CALL instruction, we may
      see an updated LR with a not-yet-updated PC. In some cases this
      may lead to failed stack unwinding. Don't preempt in this case.
      
      Change-Id: I99437b2d05869ded5c0c8cb55265dbfc933aedab
      Reviewed-on: https://go-review.googlesource.com/c/go/+/203720Reviewed-by: default avatarKeith Randall <khr@golang.org>
      a930fede
    • Michael Anthony Knyszek's avatar
      runtime: compute whether a span needs zeroing in the new page allocator · a120cc8b
      Michael Anthony Knyszek authored
      This change adds the allocNeedZero method to mheap which uses the new
      heapArena field zeroedBase to determine whether a new allocation needs
      zeroing. The purpose of this work is to avoid zeroing memory that is
      fresh from the OS in the context of the new allocator, where we no
      longer have the concept of a free span to track this information.
      
      The new field in heapArena, zeroedBase, is small, which runs counter to
      the advice in the doc comment for heapArena. Since heapArenas are
      already not a multiple of the system page size, this advice seems stale,
      and we're OK with using an extra physical page for a heapArena. So, this
      change also deletes the comment with that advice.
      
      Updates #35112.
      
      Change-Id: I688cd9fd3c57a98a6d43c45cf699543ce16697e2
      Reviewed-on: https://go-review.googlesource.com/c/go/+/203858
      Run-TryBot: Michael Knyszek <mknyszek@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      a120cc8b
    • Cherry Zhang's avatar
      runtime: add async preemption support on S390X · 933bf75e
      Cherry Zhang authored
      This CL adds support of call injection and async preemption on
      S390X.
      
      Like ARM64, we need to clobber one register (REGTMP) for
      returning from the injected call. Previous CLs have marked code
      sequences that use REGTMP async-nonpreemtible.
      
      Change-Id: I78adbc5fd70ca245da390f6266623385b45c9dfc
      Reviewed-on: https://go-review.googlesource.com/c/go/+/204106Reviewed-by: default avatarKeith Randall <khr@golang.org>
      933bf75e
    • Cherry Zhang's avatar
      cmd/internal/obj/s390x: mark unsafe points · 4751db93
      Cherry Zhang authored
      For async preemption, we will be using REGTMP as a temporary
      register in injected call on S390X, which will clobber it. So any
      code that uses REGTMP is not safe for async preemption.
      
      In the assembler backend, we expand a Prog to multiple machine
      instructions and use REGTMP as a temporary register if necessary.
      These need to be marked unsafe. Unlike ARM64 and MIPS,
      instructions on S390X are variable length so we don't use the
      length as a condition. Instead, we set a bit on the Prog whenever
      REGTMP is used.
      
      Change-Id: Ie5d14068a950f4c7cea51dff2c4a8bdc19ec9348
      Reviewed-on: https://go-review.googlesource.com/c/go/+/204105
      Run-TryBot: Cherry Zhang <cherryyz@google.com>
      Reviewed-by: default avatarKeith Randall <khr@golang.org>
      4751db93
    • Michael Anthony Knyszek's avatar
      runtime: integrate new page allocator into runtime · 689f6f77
      Michael Anthony Knyszek authored
      This change integrates all the bits and pieces of the new page allocator
      into the runtime, behind a global constant.
      
      Updates #35112.
      
      Change-Id: I6696bde7bab098a498ab37ed2a2caad2a05d30ec
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201764
      Run-TryBot: Michael Knyszek <mknyszek@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      689f6f77
    • Michael Anthony Knyszek's avatar
      runtime: make the scavenger self-paced · 21445b09
      Michael Anthony Knyszek authored
      Currently the runtime background scavenger is paced externally,
      controlled by a collection of variables which together describe a line
      that we'd like to stay under.
      
      However, the line to stay under is computed as a function of the number
      of free and unscavenged huge pages in the heap at the end of the last
      GC. Aside from this number being inaccurate (which is still acceptable),
      the scavenging system also makes an order-of-magnitude assumption as to
      how expensive scavenging a single page actually is.
      
      This change simplifies the scavenger in preparation for making it
      operate on bitmaps. It makes it so that the scavenger paces itself, by
      measuring the amount of time it takes to scavenge a single page. The
      scavenging methods on mheap already avoid breaking huge pages, so if we
      scavenge a real huge page, then we'll have paced correctly, otherwise
      we'll sleep for longer to avoid using more than scavengePercent wall
      clock time.
      
      Unfortunately, all this involves measuring time, which is quite tricky.
      Currently we don't directly account for long process sleeps or OS-level
      context switches (which is quite difficult to do in general), but we do
      account for Go scheduler overhead and variations in it by maintaining an
      EWMA of the ratio of time spent scavenging to the time spent sleeping.
      This ratio, as well as the sleep time, are bounded in order to deal with
      the aforementioned OS-related anomalies.
      
      Updates #35112.
      
      Change-Id: Ieca8b088fdfca2bebb06bcde25ef14a42fd5216b
      Reviewed-on: https://go-review.googlesource.com/c/go/+/201763
      Run-TryBot: Michael Knyszek <mknyszek@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarAustin Clements <austin@google.com>
      21445b09