Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tools/slabratetop: Fix error: incomplete definition of type 'struct s…
…lab' kernel commit 40f3bf0cb04c("mm: Convert struct page to struct slab in functions used by other subsystems") introduce slab_address() function, commit 6e48a966dfd1 ("mm/kasan: Convert to struct folio and struct slab") linux/kasan.h adds a dependency on the slab struct, This leads to the following problems: $ sudo ./slabratetop.py In file included from /virtual/main.c:13: include/linux/slub_def.h:162:26: warning: call to undeclared function 'slab_address'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] void *object = x - (x - slab_address(slab)) % cache->size; ^ include/linux/slub_def.h:162:46: error: invalid operands to binary expression ('void *' and 'unsigned int') void *object = x - (x - slab_address(slab)) % cache->size; ~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~ include/linux/slub_def.h:164:8: error: incomplete definition of type 'struct slab' (slab->objects - 1) * cache->size; ~~~~^ include/linux/kasan.h:13:8: note: forward declaration of 'struct slab' struct slab; ^ ... At first, I wanted to fix this with a kernel patch [1], however, bcc as a downstream project of the kernel, this issue should be solved inside the bcc project. This is agreed by kernel maintainer and bcc maintainer @yonghong-song. This solution is provided by @yonghong-song [0]. [0] iovisor#4438 [1] https://lore.kernel.org/all/[email protected]/ Signed-off-by: Rong Tao <[email protected]> Signed-off-by: Yonghong Song <[email protected]>
- Loading branch information