diff options
| author | Dmitriy Vyukov <dvyukov@google.com> | 2014-08-25 23:30:39 +0400 |
|---|---|---|
| committer | Dmitriy Vyukov <dvyukov@google.com> | 2014-08-25 23:30:39 +0400 |
| commit | b2c43438d20bafda5c6fee777342371d1685e5cc (patch) | |
| tree | f2ade2e714994c2dd5ecac1dba9a9ae4fb9a047b /src/pkg | |
| parent | 21a4bdef2fa2ae5425c8d309a8e914e3e514c30a (diff) | |
| download | go-b2c43438d20bafda5c6fee777342371d1685e5cc.tar.xz | |
runtime: restore scavenger constants
Once and for all.
Broken in cl/108640043.
I've messed it before. To test scavenger-related changes
one needs to alter the constants during final testing.
And then it's very easy to submit with the altered constants.
LGTM=rsc
R=golang-codereviews
CC=golang-codereviews, rsc
https://golang.org/cl/136720044
Diffstat (limited to 'src/pkg')
| -rw-r--r-- | src/pkg/runtime/extern.go | 2 | ||||
| -rw-r--r-- | src/pkg/runtime/proc.c | 9 | ||||
| -rw-r--r-- | src/pkg/runtime/runtime.c | 2 | ||||
| -rw-r--r-- | src/pkg/runtime/runtime.h | 1 |
4 files changed, 12 insertions, 2 deletions
diff --git a/src/pkg/runtime/extern.go b/src/pkg/runtime/extern.go index a5bea7e46d..1a2d9c21a2 100644 --- a/src/pkg/runtime/extern.go +++ b/src/pkg/runtime/extern.go @@ -46,6 +46,8 @@ a comma-separated list of name=val pairs. Supported names are: schedtrace: setting schedtrace=X causes the scheduler to emit a single line to standard error every X milliseconds, summarizing the scheduler state. + scavenge: scavenge=1 enables debugging mode of heap scavenger. + The GOMAXPROCS variable limits the number of operating system threads that can execute user-level Go code simultaneously. There is no limit to the number of threads that can be blocked in system calls on behalf of Go code; those do not count against diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index ce0f74aa6c..483903d6d9 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -2632,10 +2632,15 @@ sysmon(void) G *gp; // If we go two minutes without a garbage collection, force one to run. - forcegcperiod = 2*60*1e6; + forcegcperiod = 2*60*1e9; // If a heap span goes unused for 5 minutes after a garbage collection, // we hand it back to the operating system. - scavengelimit = 5*60*1e6; + scavengelimit = 5*60*1e9; + if(runtime·debug.scavenge > 0) { + // Scavenge-a-lot for testing. + forcegcperiod = 10*1e6; + scavengelimit = 20*1e6; + } lastscavenge = runtime·nanotime(); nscavenge = 0; // Make wake-up period small enough for the sampling to be correct. diff --git a/src/pkg/runtime/runtime.c b/src/pkg/runtime/runtime.c index 275fffb347..b1960088da 100644 --- a/src/pkg/runtime/runtime.c +++ b/src/pkg/runtime/runtime.c @@ -302,6 +302,7 @@ runtime·tickspersecond(void) return res; } +#pragma dataflag NOPTR DebugVars runtime·debug; static struct { @@ -314,6 +315,7 @@ static struct { {"gcdead", &runtime·debug.gcdead}, {"scheddetail", &runtime·debug.scheddetail}, {"schedtrace", &runtime·debug.schedtrace}, + {"scavenge", &runtime·debug.scavenge}, }; void diff --git a/src/pkg/runtime/runtime.h b/src/pkg/runtime/runtime.h index 4f63fdf718..8d4773b9f7 100644 --- a/src/pkg/runtime/runtime.h +++ b/src/pkg/runtime/runtime.h @@ -562,6 +562,7 @@ struct DebugVars int32 gcdead; int32 scheddetail; int32 schedtrace; + int32 scavenge; }; extern bool runtime·precisestack; |
