diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-06-19 11:25:08 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-06-19 11:56:47 +0200 |
| commit | b621d37e81b190c644e282b595878d5caffa991b (patch) | |
| tree | 0255575cee742cb6742b6a73c0ef201caf4a3504 /tools/syz-make | |
| parent | f7a1d898925ade33bd27c2574261658a18c7e563 (diff) | |
tools/syz-make: reduce number of make jobs
Ensure that we have at least 1GB per Go compiler/linker invocation.
Go compiler/linker can consume significant amount of memory
(observed to consume at least 600MB). See #1276 for context.
And we have parallelization both on make and on go levels,
this can severe oversubscribe RAM.
Note: the result can be significantly lower than the CPU number,
but this is fine because Go builds/tests are parallelized internally.
Diffstat (limited to 'tools/syz-make')
| -rw-r--r-- | tools/syz-make/make.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/syz-make/make.go b/tools/syz-make/make.go index 5cf0bd249..6dfcb21bb 100644 --- a/tools/syz-make/make.go +++ b/tools/syz-make/make.go @@ -43,12 +43,16 @@ func impl() ([]Var, error) { } parallelism := runtime.NumCPU() if mem := osutil.SystemMemorySize(); mem != 0 { - // Ensure that we have at least 1GB per Makefile job. + // Ensure that we have at least 1GB per Go compiler/linker invocation. // Go compiler/linker can consume significant amount of memory // (observed to consume at least 600MB). See #1276 for context. + // And we have parallelization both on make and on go levels, + // this can severe oversubscribe RAM. + // Note: the result can be significantly lower than the CPU number, + // but this is fine because Go builds/tests are parallelized internally. memLimit := int(mem / (1 << 30)) - if parallelism > memLimit { - parallelism = memLimit + for parallelism > 1 && parallelism*parallelism > memLimit { + parallelism-- } } vars := []Var{ |
