Re: [PATCH bpf-next v2 33/35] bpf: selftests: don't touch RLIMIT_MEMLOCK

From: Andrii Nakryiko
Date: Tue Jul 28 2020 - 02:08:52 EST


On Mon, Jul 27, 2020 at 12:21 PM Roman Gushchin <guro@xxxxxx> wrote:
>
> Since bpf is not using memlock rlimit for memory accounting,
> there are no more reasons to bump the limit.
>
> Signed-off-by: Roman Gushchin <guro@xxxxxx>
> ---

Similarly for bench, it's a tool that's not coupled with the latest
kernel version, it will be a big step down if the tool doesn't bump
rlimit on its own on slightly older kernels. Let's just keep it for
now.

> tools/testing/selftests/bpf/bench.c | 16 ---------------
> .../selftests/bpf/progs/bpf_iter_bpf_map.c | 5 ++---
> tools/testing/selftests/bpf/xdping.c | 6 ------
> tools/testing/selftests/net/reuseport_bpf.c | 20 -------------------
> 4 files changed, 2 insertions(+), 45 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/bench.c b/tools/testing/selftests/bpf/bench.c
> index 944ad4721c83..f66610541c8a 100644
> --- a/tools/testing/selftests/bpf/bench.c
> +++ b/tools/testing/selftests/bpf/bench.c
> @@ -29,25 +29,9 @@ 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()
> {
> - int err;
> -
> libbpf_set_print(libbpf_print_fn);
> -
> - err = bump_memlock_rlimit();
> - if (err)
> - fprintf(stderr, "failed to increase RLIMIT_MEMLOCK: %d", err);
> }
>

[...]