]> Cypherpunks.ru repositories - gostls13.git/commitdiff
runtime: don't eagerly collapse hugepages
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 29 Sep 2023 19:16:38 +0000 (19:16 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 2 Oct 2023 18:30:51 +0000 (18:30 +0000)
This has caused performance issues in production environments.

Disable it until further notice.

Fixes #63334.
Related to #61718 and #59960.

Change-Id: If84c5a8685825d43c912a71418f2597e44e867e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/531816
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>

src/runtime/mgcscavenge.go

index 2070492fc8478015ef7b3e3a759ca0546c8900e8..b4cb43c946acab8e356c7895873c31f01f407570 100644 (file)
@@ -1145,21 +1145,11 @@ func (s *scavengeIndex) alloc(ci chunkIdx, npages uint) {
                // Mark that we're considering this chunk as backed by huge pages.
                sc.setHugePage()
 
-               // Collapse dense chunks into huge pages and mark that
-               // we did that, but only if we're not allocating to
-               // use the entire chunk. If we're allocating an entire chunk,
-               // this is likely part of a much bigger allocation. For
-               // instance, if the caller is allocating a 1 GiB slice of bytes, we
-               // don't want to go and manually collapse all those pages; we want
-               // them to be demand-paged. If the caller is actually going to use
-               // all that memory, it'll naturally get backed by huge pages later.
-               //
-               // This also avoids having sysHugePageCollapse fail. On Linux,
-               // the call requires that some part of the huge page being collapsed
-               // is already paged in.
-               if !s.test && npages < pallocChunkPages {
-                       sysHugePageCollapse(unsafe.Pointer(chunkBase(ci)), pallocChunkBytes)
-               }
+               // TODO(mknyszek): Consider eagerly backing memory with huge pages
+               // here. In the past we've attempted to use sysHugePageCollapse
+               // (which uses MADV_COLLAPSE on Linux, and is unsupported elswhere)
+               // for this purpose, but that caused performance issues in production
+               // environments.
        }
        s.chunks[ci].store(sc)
 }