Skip to content

Commit

Permalink
[llvm-exegesis] Disable core dumps in subprocess (#74144)
Browse files Browse the repository at this point in the history
Core dumps are currently enabled within the llvm-exegesis subprocess
executor. This can create a lot of core dumps when going through
different snippets that might segfault when experimenting with memory
annotations. These core dumps are not really needed as the information
about the segfault is reported directly to the user.
  • Loading branch information
boomanaiden154 committed Dec 4, 2023
1 parent 9db6423 commit 077fe97
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#endif
#include <sys/mman.h>
#include <sys/ptrace.h>
#include <sys/resource.h>
#include <sys/socket.h>
#include <sys/syscall.h>
#include <sys/wait.h>
Expand Down Expand Up @@ -378,8 +379,21 @@ class SubProcessFunctionExecutorImpl
Twine(strsignal(ChildSignalInfo.si_signo)));
}

void disableCoreDumps() const {
struct rlimit rlim;

rlim.rlim_cur = 0;
setrlimit(RLIMIT_CORE, &rlim);
}

[[noreturn]] void prepareAndRunBenchmark(int Pipe,
const BenchmarkKey &Key) const {
// Disable core dumps in the child process as otherwise everytime we
// encounter an execution failure like a segmentation fault, we will create
// a core dump. We report the information directly rather than require the
// user inspect a core dump.
disableCoreDumps();

// The following occurs within the benchmarking subprocess
pid_t ParentPID = getppid();

Expand Down

0 comments on commit 077fe97

Please sign in to comment.