runtime: remove go119MemoryLimitSupport flag

Change-Id: I207480d991c6242a1610795605c5ec6a3b3c59de
Reviewed-on: https://go-review.googlesource.com/c/go/+/463225
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Keith Randall 2023-01-26 14:46:51 -08:00
parent 469afbcc46
commit 79edd1d19d
5 changed files with 5 additions and 12 deletions

View File

@ -414,7 +414,7 @@ func gcAssistAlloc(gp *g) {
traced := false traced := false
retry: retry:
if go119MemoryLimitSupport && gcCPULimiter.limiting() { if gcCPULimiter.limiting() {
// If the CPU limiter is enabled, intentionally don't // If the CPU limiter is enabled, intentionally don't
// assist to reduce the amount of CPU time spent in the GC. // assist to reduce the amount of CPU time spent in the GC.
if traced { if traced {

View File

@ -11,12 +11,6 @@ import (
_ "unsafe" // for go:linkname _ "unsafe" // for go:linkname
) )
// go119MemoryLimitSupport is a feature flag for a number of changes
// related to the memory limit feature (#48409). Disabling this flag
// disables those features, as well as the memory limit mechanism,
// which becomes a no-op.
const go119MemoryLimitSupport = true
const ( const (
// gcGoalUtilization is the goal CPU utilization for // gcGoalUtilization is the goal CPU utilization for
// marking as a fraction of GOMAXPROCS. // marking as a fraction of GOMAXPROCS.
@ -899,7 +893,7 @@ func (c *gcControllerState) heapGoalInternal() (goal, minTrigger uint64) {
goal = c.gcPercentHeapGoal.Load() goal = c.gcPercentHeapGoal.Load()
// Check if the memory-limit-based goal is smaller, and if so, pick that. // Check if the memory-limit-based goal is smaller, and if so, pick that.
if newGoal := c.memoryLimitHeapGoal(); go119MemoryLimitSupport && newGoal < goal { if newGoal := c.memoryLimitHeapGoal(); newGoal < goal {
goal = newGoal goal = newGoal
} else { } else {
// We're not limited by the memory limit goal, so perform a series of // We're not limited by the memory limit goal, so perform a series of

View File

@ -379,8 +379,7 @@ func (s *scavengerState) init() {
s.shouldStop = func() bool { s.shouldStop = func() bool {
// If background scavenging is disabled or if there's no work to do just stop. // If background scavenging is disabled or if there's no work to do just stop.
return heapRetained() <= scavenge.gcPercentGoal.Load() && return heapRetained() <= scavenge.gcPercentGoal.Load() &&
(!go119MemoryLimitSupport || gcController.mappedReady.Load() <= scavenge.memoryLimitGoal.Load()
gcController.mappedReady.Load() <= scavenge.memoryLimitGoal.Load())
} }
} }
if s.gomaxprocs == nil { if s.gomaxprocs == nil {

View File

@ -1270,7 +1270,7 @@ HaveSpan:
// pages not to get touched until we return. Simultaneously, it's important // pages not to get touched until we return. Simultaneously, it's important
// to do this before calling sysUsed because that may commit address space. // to do this before calling sysUsed because that may commit address space.
bytesToScavenge := uintptr(0) bytesToScavenge := uintptr(0)
if limit := gcController.memoryLimit.Load(); go119MemoryLimitSupport && !gcCPULimiter.limiting() { if limit := gcController.memoryLimit.Load(); !gcCPULimiter.limiting() {
// Assist with scavenging to maintain the memory limit by the amount // Assist with scavenging to maintain the memory limit by the amount
// that we expect to page in. // that we expect to page in.
inuse := gcController.mappedReady.Load() inuse := gcController.mappedReady.Load()

View File

@ -364,7 +364,7 @@ func parsedebugvars() {
// defaults // defaults
debug.cgocheck = 1 debug.cgocheck = 1
debug.invalidptr = 1 debug.invalidptr = 1
debug.adaptivestackstart = 1 // go119 - set this to 0 to turn larger initial goroutine stacks off debug.adaptivestackstart = 1 // set this to 0 to turn larger initial goroutine stacks off
if GOOS == "linux" { if GOOS == "linux" {
// On Linux, MADV_FREE is faster than MADV_DONTNEED, // On Linux, MADV_FREE is faster than MADV_DONTNEED,
// but doesn't affect many of the statistics that // but doesn't affect many of the statistics that