iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.36k stars 3.86k forks source link

tools/slabratetop: can't find linux/slub_def.h header #4882

Open jeromemarchand opened 8 months ago

jeromemarchand commented 8 months ago

The slab allocator has been removed from the kernel recently and the content of 'linux/slub_def.h' has been moved to 'mm/slab.h'. Slabratetop fails with the following error:

$ /usr/share/bcc/tools/slabratetop
/virtual/main.c:100:10: fatal error: 'linux/slub_def.h' file not found
  100 | #include <linux/slub_def.h>
      |          ^~~~~~~~~~~~~~~~~~
1 error generated.
Traceback (most recent call last):
  File "/usr/share/bcc/tools/slabratetop", line 201, in <module>
    b = BPF(text=bpf_text)
        ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/bcc/__init__.py", line 479, in __init__
    raise Exception("Failed to compile BPF module %s" % (src_file or "<text>"))
Exception: Failed to compile BPF module <text>

There is alreday quite some headers and definitions gymnastics in the slabratetop tool to make it work with different allocators and kernel versions. I'm not sure what the solution to this one is.