From 4fca1650892b7aba6ac219ce521543d411cf96ac Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 20 Nov 2024 08:43:01 +0100 Subject: 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. --- executor/executor_linux.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'executor/executor_linux.h') 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); -- cgit mrf-deployment