1 /* SPDX-License-Identifier: LGPL-2.1 */
3 #include "util/debug.h"
4 #include "util/rlimit.h"
6 #include <sys/resource.h>
9 * Bump the memlock so that we can get bpf maps of a reasonable size,
10 * like the ones used with 'perf trace' and with 'perf test bpf',
11 * improve this to some specific request if needed.
13 void rlimit__bump_memlock(void)
17 if (getrlimit(RLIMIT_MEMLOCK
, &rlim
) == 0) {
21 if (setrlimit(RLIMIT_MEMLOCK
, &rlim
) < 0) {
25 if (setrlimit(RLIMIT_MEMLOCK
, &rlim
) < 0)
26 pr_debug("Couldn't bump rlimit(MEMLOCK), failures may take place when creating BPF maps, etc\n");