]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - tools/perf/builtin-trace.c
perf trace: Auto bump rlimit(MEMLOCK) for eBPF maps sake
[linux.git] / tools / perf / builtin-trace.c
index 1aa2ed096f65ed9330d38003a4536af40d1e3269..4f0bbffee05f28e190cb6ff4498458a2138a8349 100644 (file)
@@ -19,6 +19,7 @@
 #include <api/fs/tracing_path.h>
 #include <bpf/bpf.h>
 #include "util/bpf_map.h"
+#include "util/rlimit.h"
 #include "builtin.h"
 #include "util/cgroup.h"
 #include "util/color.h"
@@ -3864,6 +3865,15 @@ int cmd_trace(int argc, const char **argv)
                goto out;
        }
 
+       /*
+        * Parsing .perfconfig may entail creating a BPF event, that may need
+        * to create BPF maps, so bump RLIM_MEMLOCK as the default 64K setting
+        * is too small. This affects just this process, not touching the
+        * global setting. If it fails we'll get something in 'perf trace -v'
+        * to help diagnose the problem.
+        */
+       rlimit__bump_memlock();
+
        err = perf_config(trace__config, &trace);
        if (err)
                goto out;