bcc icon indicating copy to clipboard operation
bcc copied to clipboard

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

Open jeromemarchand opened this issue 1 year ago • 0 comments

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.

jeromemarchand avatar Jan 24 '24 14:01 jeromemarchand