1. 06 Oct, 2015 4 commits
  2. 05 Oct, 2015 6 commits
  3. 04 Oct, 2015 3 commits
  4. 03 Oct, 2015 6 commits
  5. 02 Oct, 2015 14 commits
    • Austin Clements's avatar
      runtime: use 4 byte writes in amd64p32 memmove/memclr · 9f6df6c9
      Austin Clements authored
      Currently, amd64p32's memmove and memclr use 8 byte writes as much as
      possible and 1 byte writes for the tail of the object. However, if an
      object ends with a 4 byte pointer at an 8 byte aligned offset, this
      may copy/zero the pointer field one byte at a time, allowing the
      garbage collector to observe a partially copied pointer.
      
      Fix this by using 4 byte writes instead of 8 byte writes.
      
      Updates #12552.
      
      Change-Id: I13324fd05756fb25ae57e812e836f0a975b5595c
      Reviewed-on: https://go-review.googlesource.com/15370
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      9f6df6c9
    • Austin Clements's avatar
      runtime: adjust huge page flags only on huge page granularity · 44078a32
      Austin Clements authored
      This fixes an issue where the runtime panics with "out of memory" or
      "cannot allocate memory" even though there's ample memory by reducing
      the number of memory mappings created by the memory allocator.
      
      Commit 7e1b61c7 worked around issue #8832 where Linux's transparent
      huge page support could dramatically increase the RSS of a Go process
      by setting the MADV_NOHUGEPAGE flag on any regions of pages released
      to the OS with MADV_DONTNEED. This had the side effect of also
      increasing the number of VMAs (memory mappings) in a Go address space
      because a separate VMA is needed for every region of the virtual
      address space with different flags. Unfortunately, by default, Linux
      limits the number of VMAs in an address space to 65530, and a large
      heap can quickly reach this limit when the runtime starts scavenging
      memory.
      
      This commit dramatically reduces the number of VMAs. It does this
      primarily by only adjusting the huge page flag at huge page
      granularity. With this change, on amd64, even a pessimal heap that
      alternates between MADV_NOHUGEPAGE and MADV_HUGEPAGE must reach 128GB
      to reach the VMA limit. Because of this rounding to huge page
      granularity, this change is also careful to leave large used and
      unused regions huge page-enabled.
      
      This change reduces the maximum number of VMAs during the runtime
      benchmarks with GODEBUG=scavenge=1 from 692 to 49.
      
      Fixes #12233.
      
      Change-Id: Ic397776d042f20d53783a1cacf122e2e2db00584
      Reviewed-on: https://go-review.googlesource.com/15191Reviewed-by: 's avatarKeith Randall <khr@golang.org>
      44078a32
    • Austin Clements's avatar
      runtime: remove sweep wait loop in finishsweep_m · 9a31d38f
      Austin Clements authored
      In general, finishsweep_m must block until any spans that are
      concurrently being swept have been swept. It accomplishes this by
      looping over all spans, which, as in the previous commit, takes
      ~1ms/heap GB. Unfortunately, we do this during the STW sweep
      termination phase, so multi-gigabyte heaps can push our STW time past
      10ms.
      
      However, there's no need to do this wait if the world is stopped
      because, in effect, stopping the world already had to wait for
      anything that was sweeping (and if it didn't, the wait in
      finishsweep_m would deadlock). Hence, we can simply skip this loop if
      the world is stopped, such as during sweep termination. In fact,
      currently all calls to finishsweep_m are STW, but this hasn't always
      been the case and may not be the case in the future, so we keep the
      logic around.
      
      For 24GB heaps, this reduces max pause time by 75% relative to tip and
      by 90% relative to Go 1.5. Notably, all pauses are now well under
      10ms. Here are the results for the garbage benchmark:
      
                     ------------- max pause ------------
      Heap   Procs   after change   before change   1.5.1
      24GB     12        3.8ms          16ms         37ms
      24GB      4        3.7ms          16ms         37ms
       4GB      4        3.7ms           3ms        6.9ms
      
      In the 4GB/4P case, it seems the "before change" run got lucky: the
      max went up, but the 99%ile pause time went down from 3ms to 2.04ms.
      
      Change-Id: Ica22189559f231d408ef2815019c9dbb5f38bf31
      Reviewed-on: https://go-review.googlesource.com/15071Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      9a31d38f
    • Austin Clements's avatar
      runtime: remove in-use page count loop from STW · dac220b0
      Austin Clements authored
      In order to compute the sweep ratio, the runtime needs to know how
      many pages belong to spans in state _MSpanInUse. Currently it finds
      this out by looping over all spans during mark termination. However,
      this takes ~1ms/heap GB, so multi-gigabyte heaps can quickly push our
      STW time past 10ms.
      
      Replace the loop with an actively maintained count of in-use pages.
      
      For multi-gigabyte heaps, this reduces max mark termination pause time
      by 75%–90% relative to tip and by 85%–95% relative to Go 1.5.1. This
      shifts the longest pause time for large heaps to the sweep termination
      phase, so it only slightly decreases max pause time, though it roughly
      halves mean pause time. Here are the results for the garbage
      benchmark:
      
                     ---- max mark termination pause ----
      Heap   Procs   after change   before change   1.5.1
      24GB     12        1.9ms          18ms         37ms
      24GB      4        3.7ms          18ms         37ms
       4GB      4        920µs         3.8ms        6.9ms
      
      Fixes #11484.
      
      Change-Id: Ia2d28bb8a1e4f1c3b8ebf79fb203f12b9bf114ac
      Reviewed-on: https://go-review.googlesource.com/15070Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      dac220b0
    • Austin Clements's avatar
      runtime: scan objects with finalizers concurrently · 608c1b0d
      Austin Clements authored
      This reduces pause time by ~25% relative to tip and by ~50% relative
      to Go 1.5.1.
      
      Currently one of the steps of STW mark termination is to loop (in
      parallel) over all spans to find objects with finalizers in order to
      mark all objects reachable from these objects and to treat the
      finalizer special as a root. Unfortunately, even if there are no
      finalizers at all, this loop takes roughly 1 ms/heap GB/core, so
      multi-gigabyte heaps can quickly push our STW time past 10ms.
      
      Fix this by moving this scan from mark termination to concurrent scan,
      where it can run in parallel with mutators. The loop itself could also
      be optimized, but this cost is small compared to concurrent marking.
      
      Making this scan concurrent introduces two complications:
      
      1) The scan currently walks the specials list of each span without
      locking it, which is safe only with the world stopped. We fix this by
      speculatively checking if a span has any specials (the vast majority
      won't) and then locking the specials list only if there are specials
      to check.
      
      2) An object can have a finalizer set after concurrent scan, in which
      case it won't have been marked appropriately by concurrent scan. If
      the finalizer is a closure and is only reachable from the special, it
      could be swept before it is run. Likewise, if the object is not marked
      yet when the finalizer is set and then becomes unreachable before it
      is marked, other objects reachable only from it may be swept before
      the finalizer function is run. We fix this issue by making
      addfinalizer ensure the same marking invariants as markroot does.
      
      For multi-gigabyte heaps, this reduces max pause time by 20%–30%
      relative to tip (depending on GOMAXPROCS) and by ~50% relative to Go
      1.5.1 (where this loop was neither concurrent nor parallel). Here are
      the results for the garbage benchmark:
      
                     ---------------- max pause ----------------
      Heap   Procs   Concurrent scan   STW parallel scan   1.5.1
      24GB     12         18ms              23ms            37ms
      24GB      4         18ms              25ms            37ms
       4GB      4         3.8ms            4.9ms           6.9ms
      
      In all cases, 95%ile pause time is similar to the max pause time. This
      also improves mean STW time by 10%–30%.
      
      Fixes #11485.
      
      Change-Id: I9359d8c3d120a51d23d924b52bf853a1299b1dfd
      Reviewed-on: https://go-review.googlesource.com/14982Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      608c1b0d
    • Austin Clements's avatar
      runtime: introduce gcMode type for GC modes · fbd2660a
      Austin Clements authored
      Currently, the GC modes constants are untyped and functions pass them
      around as ints. Clean this up by introducing a proper type for these
      constant.
      
      Change-Id: Ibc022447bdfa203644921fbb548312d7e2272e8d
      Reviewed-on: https://go-review.googlesource.com/14981Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Austin Clements <austin@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      fbd2660a
    • Austin Clements's avatar
      runtime: fix out-of-date comment on gcWork usage · 1b84bb8c
      Austin Clements authored
      Change-Id: I3c21ffa80a5c14911e07238b1f64bec686ed7b72
      Reviewed-on: https://go-review.googlesource.com/14980Reviewed-by: 's avatarMinux Ma <minux@golang.org>
      1b84bb8c
    • Brad Fitzpatrick's avatar
      syscall: skip a couple tests when running under Kubernetes · f35310ed
      Brad Fitzpatrick authored
      Update #12815
      
      Change-Id: I3bf6de74bc8ab07000fe9a4308299839ef20632f
      Reviewed-on: https://go-review.googlesource.com/15283Reviewed-by: 's avatarEvan Brown <evanbrown@google.com>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      f35310ed
    • Robert Griesemer's avatar
      readme: emphasize issue tracker is for bugs/proposals · 4c2a4004
      Robert Griesemer authored
      Removed direct link to issue tracker in the README - it makes it too
      easy to use it for a question - and it's abused multiple times a day
      for questions. It's easy enough to find it if there's a real issue
      to report.
      
      Added sentence to point people at golang-nuts and the new forum.
      
      Change-Id: If75bab888cda064aceeefc49ef672fbb964f8f54
      Reviewed-on: https://go-review.googlesource.com/15284Reviewed-by: 's avatarJason Buberel <jbuberel@google.com>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      4c2a4004
    • Ian Gudger's avatar
      database/sql: fix case where Stmt.Close discards error · 73fe6123
      Ian Gudger authored
      Fixes a case where the Stmt.Close() function in database/sql discards any error generated by the Close() function of the contained driverStmt.
      
      Fixes #12798
      
      Change-Id: I40384d6165856665b062d15a643e4ecc09d63fda
      Reviewed-on: https://go-review.googlesource.com/15178Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      73fe6123
    • Ian Lance Taylor's avatar
      misc/cgo/testsanitizers: skip test for version of clang before 3.6 · f80ff56a
      Ian Lance Taylor authored
      I've tested with clang 3.6.  The builder is running 3.5, and fails.
      
      Fixes #12814.
      
      Change-Id: I087fb75c3a24bed7f7fa5e9d7a1444590a316d63
      Reviewed-on: https://go-review.googlesource.com/15259Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      f80ff56a
    • David Crawshaw's avatar
      runtime: darwin/386 entrypoint for c-archive · 47ccf96a
      David Crawshaw authored
      Change-Id: Ic22597b5e2824cffe9598cb9b506af3426c285fd
      Reviewed-on: https://go-review.googlesource.com/12412
      Run-TryBot: David Crawshaw <crawshaw@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      47ccf96a
    • Michael Hudson-Doyle's avatar
      runtime: adjust the ppc64x memmove and memclr to copy by word as much as it can · 2c911143
      Michael Hudson-Doyle authored
      Issue #12552 can happen on ppc64 too, although much less frequently in my
      testing. I'm fairly sure this fixes it (2 out of 200 runs of oracle.test failed
      without this change and 0 of 200 failed with it). It's also a lot faster for
      large moves/clears:
      
      name           old speed      new speed       delta
      Memmove1-6      157MB/s ± 9%    144MB/s ± 0%    -8.20%         (p=0.004 n=10+9)
      Memmove2-6      281MB/s ± 1%    249MB/s ± 1%   -11.53%        (p=0.000 n=10+10)
      Memmove3-6      376MB/s ± 1%    328MB/s ± 1%   -12.64%        (p=0.000 n=10+10)
      Memmove4-6      475MB/s ± 4%    345MB/s ± 1%   -27.28%         (p=0.000 n=10+8)
      Memmove5-6      540MB/s ± 1%    393MB/s ± 0%   -27.21%        (p=0.000 n=10+10)
      Memmove6-6      609MB/s ± 0%    423MB/s ± 0%   -30.56%         (p=0.000 n=9+10)
      Memmove7-6      659MB/s ± 0%    468MB/s ± 0%   -28.99%         (p=0.000 n=8+10)
      Memmove8-6      705MB/s ± 0%   1295MB/s ± 1%   +83.73%          (p=0.000 n=9+9)
      Memmove9-6      740MB/s ± 1%   1241MB/s ± 1%   +67.61%         (p=0.000 n=10+8)
      Memmove10-6     780MB/s ± 0%   1162MB/s ± 1%   +48.95%         (p=0.000 n=10+9)
      Memmove11-6     811MB/s ± 0%   1180MB/s ± 0%   +45.58%          (p=0.000 n=8+9)
      Memmove12-6     820MB/s ± 1%   1073MB/s ± 1%   +30.83%         (p=0.000 n=10+9)
      Memmove13-6     849MB/s ± 0%   1068MB/s ± 1%   +25.87%        (p=0.000 n=10+10)
      Memmove14-6     877MB/s ± 0%    911MB/s ± 0%    +3.83%        (p=0.000 n=10+10)
      Memmove15-6     893MB/s ± 0%    922MB/s ± 0%    +3.25%         (p=0.000 n=10+9)
      Memmove16-6     897MB/s ± 1%   2418MB/s ± 1%  +169.67%         (p=0.000 n=10+9)
      Memmove32-6     908MB/s ± 0%   3927MB/s ± 2%  +332.64%         (p=0.000 n=10+8)
      Memmove64-6    1.11GB/s ± 0%   5.59GB/s ± 0%  +404.64%          (p=0.000 n=9+9)
      Memmove128-6   1.25GB/s ± 0%   6.71GB/s ± 2%  +437.49%         (p=0.000 n=9+10)
      Memmove256-6   1.33GB/s ± 0%   7.25GB/s ± 1%  +445.06%        (p=0.000 n=10+10)
      Memmove512-6   1.38GB/s ± 0%   8.87GB/s ± 0%  +544.43%        (p=0.000 n=10+10)
      Memmove1024-6  1.40GB/s ± 0%  10.00GB/s ± 0%  +613.80%        (p=0.000 n=10+10)
      Memmove2048-6  1.41GB/s ± 0%  10.65GB/s ± 0%  +652.95%         (p=0.000 n=9+10)
      Memmove4096-6  1.42GB/s ± 0%  11.01GB/s ± 0%  +675.37%         (p=0.000 n=8+10)
      Memclr5-6       269MB/s ± 1%    264MB/s ± 0%    -1.80%        (p=0.000 n=10+10)
      Memclr16-6      600MB/s ± 0%    887MB/s ± 1%   +47.83%        (p=0.000 n=10+10)
      Memclr64-6     1.06GB/s ± 0%   2.91GB/s ± 1%  +174.58%         (p=0.000 n=8+10)
      Memclr256-6    1.32GB/s ± 0%   6.58GB/s ± 0%  +399.86%         (p=0.000 n=9+10)
      Memclr4096-6   1.42GB/s ± 0%  10.90GB/s ± 0%  +668.03%         (p=0.000 n=8+10)
      Memclr65536-6  1.43GB/s ± 0%  11.37GB/s ± 0%  +697.83%          (p=0.000 n=9+8)
      GoMemclr5-6     359MB/s ± 0%    360MB/s ± 0%    +0.46%        (p=0.000 n=10+10)
      GoMemclr16-6    750MB/s ± 0%   1264MB/s ± 1%   +68.45%        (p=0.000 n=10+10)
      GoMemclr64-6   1.17GB/s ± 0%   3.78GB/s ± 1%  +223.58%         (p=0.000 n=10+9)
      GoMemclr256-6  1.35GB/s ± 0%   7.47GB/s ± 0%  +452.44%        (p=0.000 n=10+10)
      
      Update #12552
      
      Change-Id: I7192e9deb9684a843aed37f58a16a4e29970e893
      Reviewed-on: https://go-review.googlesource.com/14840Reviewed-by: 's avatarMinux Ma <minux@golang.org>
      2c911143
    • Mikio Hara's avatar
      runtime: drop sigfwd from signal forwarding unsupported platforms · 9fb79380
      Mikio Hara authored
      This change splits signal_unix.go into signal_unix.go and
      signal2_unix.go and removes the fake symbol sigfwd from signal
      forwarding unsupported platforms for clarification purpose.
      
      Change-Id: I205eab5cf1930fda8a68659b35cfa9f3a0e67ca6
      Reviewed-on: https://go-review.googlesource.com/12062Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      9fb79380
  6. 01 Oct, 2015 7 commits