diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-11-20 08:43:01 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-11-20 11:33:58 +0000 |
| commit | 4fca1650892b7aba6ac219ce521543d411cf96ac (patch) | |
| tree | 668b39c6f72c509a44dabc13c0fcdcac386a1f81 /executor/executor_linux.h | |
| parent | f56b4dcc82d7af38bf94d643c5750cf49a91a297 (diff) | |
executor: increase coverage buffer size
The coverage buffer frequently overflows.
We cannot increase it radically b/c they consume lots of memory
(num procs x num kcovs x buffer size) and lead to OOM kills
(at least with 8 procs and 2GB KASAN VM).
So increase it 2x and slightly reduce number of threads/kcov descriptors.
However, in snapshot mode we can be more aggressive (only 1 proc).
This reduces number of overflows by ~~2-4x depending on syscall.
Diffstat (limited to 'executor/executor_linux.h')
| -rw-r--r-- | executor/executor_linux.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/executor/executor_linux.h b/executor/executor_linux.h index f2e9d4df6..e952e6ea9 100644 --- a/executor/executor_linux.h +++ b/executor/executor_linux.h @@ -13,6 +13,12 @@ static bool pkeys_enabled; +// The coverage buffer can realistically overflow. In the non-snapshot mode we cannot afford +// very large buffer b/c there are usually multiple procs, and each of them consumes +// significant amount of memory. In snapshot mode we have only one proc, so we can have +// larger coverage buffer. +const int kSnapshotCoverSize = 1024 << 10; + const unsigned long KCOV_TRACE_PC = 0; const unsigned long KCOV_TRACE_CMP = 1; @@ -101,7 +107,8 @@ static void cover_open(cover_t* cov, bool extra) failmsg("filed to dup cover fd", "from=%d, to=%d", fd, cov->fd); close(fd); const int kcov_init_trace = is_kernel_64_bit ? KCOV_INIT_TRACE64 : KCOV_INIT_TRACE32; - const int cover_size = extra ? kExtraCoverSize : kCoverSize; + const int cover_size = extra ? kExtraCoverSize : flag_snapshot ? kSnapshotCoverSize + : kCoverSize; if (ioctl(cov->fd, kcov_init_trace, cover_size)) fail("cover init trace write failed"); cov->mmap_alloc_size = cover_size * (is_kernel_64_bit ? 8 : 4); |
