BPF List
 help / color / mirror / Atom feed
* [PATCH v4 bpf-next 0/2] libbpf: auto-bump RLIMIT_MEMLOCK on old kernels
@ 2021-12-14 19:59 Andrii Nakryiko
  2021-12-14 19:59 ` [PATCH v4 bpf-next 1/2] libbpf: auto-bump RLIMIT_MEMLOCK if kernel needs it for BPF Andrii Nakryiko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2021-12-14 19:59 UTC (permalink / raw)
  To: bpf, ast, daniel; +Cc: andrii, kernel-team

Make libbpf bump RLIMIT_MEMLOCK, similarly to BCC, if kernel is old enough to
use memcg-based memory accounting for BPF. Patch #2 drops explicit
setrlimi(RLIMIT_MEMLOCK) calls in test_progs, test_maps, and test_verifier.

v3->v4:
  - use detection based on bpf_ktime_get_coarse_ns() helper (Daniel);
v2->v3:
  - use difference in fdinfo's memlock reporting to detect memcg;
v1->v2:
  - fix up out-of-sync comments (Toke).


Andrii Nakryiko (2):
  libbpf: auto-bump RLIMIT_MEMLOCK if kernel needs it for BPF
  selftests/bpf: remove explicit setrlimit(RLIMIT_MEMLOCK) in main
    selftests

 tools/lib/bpf/bpf.c                           | 81 +++++++++++++++++++
 tools/lib/bpf/bpf.h                           |  2 +
 tools/lib/bpf/libbpf.c                        | 47 +++--------
 tools/lib/bpf/libbpf.map                      |  1 +
 tools/lib/bpf/libbpf_internal.h               | 39 +++++++++
 tools/lib/bpf/libbpf_legacy.h                 | 12 ++-
 tools/testing/selftests/bpf/bench.c           | 16 ----
 tools/testing/selftests/bpf/prog_tests/btf.c  |  1 -
 .../bpf/prog_tests/select_reuseport.c         |  1 -
 .../selftests/bpf/prog_tests/sk_lookup.c      |  1 -
 .../selftests/bpf/prog_tests/sock_fields.c    |  1 -
 tools/testing/selftests/bpf/test_maps.c       |  1 -
 tools/testing/selftests/bpf/test_progs.c      |  2 -
 tools/testing/selftests/bpf/test_verifier.c   |  4 +-
 14 files changed, 146 insertions(+), 63 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-14 21:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-14 19:59 [PATCH v4 bpf-next 0/2] libbpf: auto-bump RLIMIT_MEMLOCK on old kernels Andrii Nakryiko
2021-12-14 19:59 ` [PATCH v4 bpf-next 1/2] libbpf: auto-bump RLIMIT_MEMLOCK if kernel needs it for BPF Andrii Nakryiko
2021-12-14 19:59 ` [PATCH v4 bpf-next 2/2] selftests/bpf: remove explicit setrlimit(RLIMIT_MEMLOCK) in main selftests Andrii Nakryiko
2021-12-14 21:20 ` [PATCH v4 bpf-next 0/2] libbpf: auto-bump RLIMIT_MEMLOCK on old kernels patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox