Commit c164b8b4 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Daniel Borkmann
Browse files

selftests/bpf: Remove explicit setrlimit(RLIMIT_MEMLOCK) in main selftests



As libbpf now is able to automatically take care of RLIMIT_MEMLOCK
increase (or skip it altogether on recent enough kernels), remove
explicit setrlimit() invocations in bench, test_maps, test_verifier, and
test_progs.

Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211214195904.1785155-3-andrii@kernel.org
parent e542f2c4
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -29,26 +29,10 @@ static int libbpf_print_fn(enum libbpf_print_level level,
	return vfprintf(stderr, format, args);
}

static int bump_memlock_rlimit(void)
{
	struct rlimit rlim_new = {
		.rlim_cur	= RLIM_INFINITY,
		.rlim_max	= RLIM_INFINITY,
	};

	return setrlimit(RLIMIT_MEMLOCK, &rlim_new);
}

void setup_libbpf(void)
{
	int err;

	libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
	libbpf_set_print(libbpf_print_fn);

	err = bump_memlock_rlimit();
	if (err)
		fprintf(stderr, "failed to increase RLIMIT_MEMLOCK: %d", err);
}

void false_hits_report_progress(int iter, struct bench_res *res, long delta_ns)
+0 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
#include <bpf/libbpf.h>
#include <bpf/btf.h>

#include "bpf_rlimit.h"
#include "bpf_util.h"
#include "../test_btf.h"
#include "test_progs.h"
+0 −1
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@
#include <netinet/in.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
#include "bpf_rlimit.h"
#include "bpf_util.h"

#include "test_progs.h"
+0 −1
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@
#include <bpf/bpf.h>

#include "test_progs.h"
#include "bpf_rlimit.h"
#include "bpf_util.h"
#include "cgroup_helpers.h"
#include "network_helpers.h"
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
#include "network_helpers.h"
#include "cgroup_helpers.h"
#include "test_progs.h"
#include "bpf_rlimit.h"
#include "test_sock_fields.skel.h"

enum bpf_linum_array_idx {
Loading