Skip to content

Commit

Permalink
runtime: remove go119MemoryLimitSupport flag
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
randall77 authored and pull[bot] committed Aug 7, 2023
1 parent 05ef072 commit 08b80c1
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/runtime/mgcmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ func gcAssistAlloc(gp *g) {

traced := false
retry:
if go119MemoryLimitSupport && gcCPULimiter.limiting() {
if gcCPULimiter.limiting() {
// If the CPU limiter is enabled, intentionally don't
// assist to reduce the amount of CPU time spent in the GC.
if traced {
Expand Down
8 changes: 1 addition & 7 deletions src/runtime/mgcpacer.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ import (
_ "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 (
// gcGoalUtilization is the goal CPU utilization for
// marking as a fraction of GOMAXPROCS.
Expand Down Expand Up @@ -899,7 +893,7 @@ func (c *gcControllerState) heapGoalInternal() (goal, minTrigger uint64) {
goal = c.gcPercentHeapGoal.Load()

// 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
} else {
// We're not limited by the memory limit goal, so perform a series of
Expand Down
3 changes: 1 addition & 2 deletions src/runtime/mgcscavenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,7 @@ func (s *scavengerState) init() {
s.shouldStop = func() bool {
// If background scavenging is disabled or if there's no work to do just stop.
return heapRetained() <= scavenge.gcPercentGoal.Load() &&
(!go119MemoryLimitSupport ||
gcController.mappedReady.Load() <= scavenge.memoryLimitGoal.Load())
gcController.mappedReady.Load() <= scavenge.memoryLimitGoal.Load()
}
}
if s.gomaxprocs == nil {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/mheap.go
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,7 @@ HaveSpan:
// pages not to get touched until we return. Simultaneously, it's important
// to do this before calling sysUsed because that may commit address space.
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
// that we expect to page in.
inuse := gcController.mappedReady.Load()
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/runtime1.go
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ func parsedebugvars() {
// defaults
debug.cgocheck = 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" {
// On Linux, MADV_FREE is faster than MADV_DONTNEED,
// but doesn't affect many of the statistics that
Expand Down

0 comments on commit 08b80c1

Please sign in to comment.