From 33393d3008969e43d26f0e4b3e71198130f9f44d Mon Sep 17 00:00:00 2001 From: Jerome Marchand Date: Thu, 18 Feb 2021 11:33:20 +0100 Subject: [PATCH] tools: include kasan header in slabtoprate slabtoprate fails on 5.10 kernels because of a missing kasan_reset_tag declaration. We need to include the kasan header file. Fixes the following error: In file included from /virtual/main.c:12: include/linux/slub_def.h:181:27: warning: implicit declaration of function 'kasan_reset_tag' is invalid in C99 [-Wimplicit-function-declaration] return reciprocal_divide(kasan_reset_tag(obj) - addr, ^ include/linux/slub_def.h:181:48: error: invalid operands to binary expression ('int' and 'void *') return reciprocal_divide(kasan_reset_tag(obj) - addr, ~~~~~~~~~~~~~~~~~~~~ ^ ~~~~ 1 warning and 1 error generated. Traceback (most recent call last): File "/usr/share/bcc/tools/slabratetop", line 115, in b = BPF(text=bpf_text) File "/usr/lib/python3.9/site-packages/bcc/__init__.py", line 364, in __init__ raise Exception("Failed to compile BPF module %s" % (src_file or "")) Exception: Failed to compile BPF module --- tools/slabratetop.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/slabratetop.py b/tools/slabratetop.py index 182dbd1d..75280c6d 100755 --- a/tools/slabratetop.py +++ b/tools/slabratetop.py @@ -62,6 +62,7 @@ loadavg = "/proc/loadavg" bpf_text = """ #include #include +#include // memcg_cache_params is a part of kmem_cache, but is not publicly exposed in // kernel versions 5.4 to 5.8. Define an empty struct for it here to allow the -- 2.29.2