Skip to content

Commit 595deec

Browse files
mknyszekgopherbot
authored andcommitted
runtime: don't eagerly collapse hugepages
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Michael Knyszek <[email protected]>
1 parent 0362f5b commit 595deec

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

src/runtime/mgcscavenge.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,21 +1145,11 @@ func (s *scavengeIndex) alloc(ci chunkIdx, npages uint) {
11451145
// Mark that we're considering this chunk as backed by huge pages.
11461146
sc.setHugePage()
11471147

1148-
// Collapse dense chunks into huge pages and mark that
1149-
// we did that, but only if we're not allocating to
1150-
// use the entire chunk. If we're allocating an entire chunk,
1151-
// this is likely part of a much bigger allocation. For
1152-
// instance, if the caller is allocating a 1 GiB slice of bytes, we
1153-
// don't want to go and manually collapse all those pages; we want
1154-
// them to be demand-paged. If the caller is actually going to use
1155-
// all that memory, it'll naturally get backed by huge pages later.
1156-
//
1157-
// This also avoids having sysHugePageCollapse fail. On Linux,
1158-
// the call requires that some part of the huge page being collapsed
1159-
// is already paged in.
1160-
if !s.test && npages < pallocChunkPages {
1161-
sysHugePageCollapse(unsafe.Pointer(chunkBase(ci)), pallocChunkBytes)
1162-
}
1148+
// TODO(mknyszek): Consider eagerly backing memory with huge pages
1149+
// here. In the past we've attempted to use sysHugePageCollapse
1150+
// (which uses MADV_COLLAPSE on Linux, and is unsupported elswhere)
1151+
// for this purpose, but that caused performance issues in production
1152+
// environments.
11631153
}
11641154
s.chunks[ci].store(sc)
11651155
}

0 commit comments

Comments
 (0)