From f266e634bc5ae6d6871d3b55d432a73f1baed4d4 Mon Sep 17 00:00:00 2001 From: Dave Marchevsky Date: Thu, 6 Jan 2022 22:19:36 -0500 Subject: [PATCH] libbpf-tools/klockstat: no more rlimit bumping + add comment The PR adding the libbpf-tools port of klockstat was sitting in a mergeable state for some time. Meanwhile, libbpf stopped exposing rlimit_memlock bumping API and now does the rlimit bump automatically if necessary. So remove the bump_rlimit_memlock call and set libbpf strict mode for this tool. Also, add a comment (from @brho's PR summary in #3688) detailing the differences in default behavior between the libbpf-tools and bcc-python versions. Signed-off-by: Dave Marchevsky --- libbpf-tools/klockstat.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libbpf-tools/klockstat.c b/libbpf-tools/klockstat.c index 330915dd..f16b760e 100644 --- a/libbpf-tools/klockstat.c +++ b/libbpf-tools/klockstat.c @@ -4,6 +4,12 @@ * Based on klockstat from BCC by Jiri Olsa and others * 2021-10-26 Barret Rhoden Created this. */ +/* Differences from BCC python tool: + * - can specify a lock by ksym name, using '-L' + * - tracks whichever task had the max time for acquire and hold, outputted + * when '-s' > 1 (otherwise it's cluttered). + * - does not reset stats each interval by default. Can request with -R. + */ #include #include #include @@ -484,12 +490,7 @@ int main(int argc, char **argv) sigaction(SIGINT, &sigact, 0); - err = bump_memlock_rlimit(); - if (err) { - warn("failed to increase rlimit: %d\n", err); - err = 1; - goto cleanup; - } + libbpf_set_strict_mode(LIBBPF_STRICT_ALL); ksyms = ksyms__load(); if (!ksyms) { -- 2.34.1