diff options
Diffstat (limited to 'libgo/go/runtime/mgcscavenge.go')
-rw-r--r-- | libgo/go/runtime/mgcscavenge.go | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libgo/go/runtime/mgcscavenge.go b/libgo/go/runtime/mgcscavenge.go index da5be70..3fa1c46 100644 --- a/libgo/go/runtime/mgcscavenge.go +++ b/libgo/go/runtime/mgcscavenge.go @@ -18,12 +18,12 @@ // application down to a goal. // // That goal is defined as: -// (retainExtraPercent+100) / 100 * (next_gc / last_next_gc) * last_heap_inuse +// (retainExtraPercent+100) / 100 * (heapGoal / lastHeapGoal) * last_heap_inuse // // Essentially, we wish to have the application's RSS track the heap goal, but // the heap goal is defined in terms of bytes of objects, rather than pages like // RSS. As a result, we need to take into account for fragmentation internal to -// spans. next_gc / last_next_gc defines the ratio between the current heap goal +// spans. heapGoal / lastHeapGoal defines the ratio between the current heap goal // and the last heap goal, which tells us by how much the heap is growing and // shrinking. We estimate what the heap will grow to in terms of pages by taking // this ratio and multiplying it by heap_inuse at the end of the last GC, which @@ -118,12 +118,12 @@ func gcPaceScavenger() { // We never scavenge before the 2nd GC cycle anyway (we don't have enough // information about the heap yet) so this is fine, and avoids a fault // or garbage data later. - if memstats.last_next_gc == 0 { + if gcController.lastHeapGoal == 0 { mheap_.scavengeGoal = ^uint64(0) return } // Compute our scavenging goal. - goalRatio := float64(atomic.Load64(&memstats.next_gc)) / float64(memstats.last_next_gc) + goalRatio := float64(atomic.Load64(&gcController.heapGoal)) / float64(gcController.lastHeapGoal) retainedGoal := uint64(float64(memstats.last_heap_inuse) * goalRatio) // Add retainExtraPercent overhead to retainedGoal. This calculation // looks strange but the purpose is to arrive at an integer division @@ -207,7 +207,7 @@ func wakeScavenger() { // Ready the goroutine by injecting it. We use injectglist instead // of ready or goready in order to allow us to run this function // without a P. injectglist also avoids placing the goroutine in - // the current P's runnext slot, which is desireable to prevent + // the current P's runnext slot, which is desirable to prevent // the scavenger from interfering with user goroutine scheduling // too much. var list gList @@ -249,7 +249,7 @@ func scavengeSleep(ns int64) int64 { // The background scavenger maintains the RSS of the application below // the line described by the proportional scavenging statistics in // the mheap struct. -func bgscavenge(c chan int) { +func bgscavenge() { setSystemGoroutine() scavenge.g = getg() @@ -263,7 +263,7 @@ func bgscavenge(c chan int) { wakeScavenger() } - c <- 1 + gcenable_setup <- 1 goparkunlock(&scavenge.lock, waitReasonGCScavengeWait, traceEvGoBlock, 1) // Exponentially-weighted moving average of the fraction of time this @@ -374,7 +374,7 @@ func bgscavenge(c chan int) { // Due to OS-related anomalies we may "sleep" for an inordinate amount // of time. Let's avoid letting the ratio get out of hand by bounding // the sleep time we use in our EWMA. - const minFraction = 1 / 1000 + const minFraction = 1.0 / 1000.0 if fraction < minFraction { fraction = minFraction } |