aboutsummaryrefslogtreecommitdiffstats
path: root/prog/mutation.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-12-17 13:00:48 +0100
committerDmitry Vyukov <dvyukov@google.com>2022-12-22 10:11:08 +0100
commit1f82f0f8c44b9035420b1d9b9800fc9008fa15d7 (patch)
treef77e5257a6056cea9e271127a0d7dd8b472d996f /prog/mutation.go
parenta0df376348d2ad1d3e557ea221e75c78a5d9fd96 (diff)
pkg/image: optimize image decompression
Benchmark results: name old time/op new time/op delta Decompress-8 24.7ms ± 1% 13.4ms ± 4% -45.81% (p=0.000 n=16+19) name old alloc/op new alloc/op delta Decompress-8 67.2MB ± 0% 0.0MB ± 1% -99.98% (p=0.000 n=18+20) name old allocs/op new allocs/op delta Decompress-8 188 ± 0% 167 ± 0% -11.17% (p=0.000 n=20+20) Test process memory consumption drops from 220MB to 80MB.
Diffstat (limited to 'prog/mutation.go')
-rw-r--r--prog/mutation.go8
1 files changed, 0 insertions, 8 deletions
diff --git a/prog/mutation.go b/prog/mutation.go
index 5a38cfa88..09fdfa69c 100644
--- a/prog/mutation.go
+++ b/prog/mutation.go
@@ -9,7 +9,6 @@ import (
"math"
"math/rand"
"sort"
- "sync"
"github.com/google/syzkaller/pkg/image"
)
@@ -385,17 +384,10 @@ func (t *BufferType) mutate(r *randGen, s *state, arg Arg, ctx ArgCtx) (calls []
return
}
-var imageMu sync.Mutex
-
func (r *randGen) mutateImage(compressed []byte) (data []byte, retry bool) {
if len(compressed) == 0 {
return compressed, true
}
- // Don't decompress more than one image at a time
- // since it can consume lots of memory.
- // Reconsider when/if we move mutation to the host process.
- imageMu.Lock()
- defer imageMu.Unlock()
data, dtor := image.MustDecompress(compressed)
defer dtor()
if len(data) == 0 {