From fa103457fbdd7825010fdf28b402ccfef271b844 Mon Sep 17 00:00:00 2001 From: Gary Lin Date: Wed, 14 Mar 2018 18:14:56 +0800 Subject: [PATCH] tools/slabratetop: detect the current memory allocator Currently, slabratetop always included slub_def.h. For the system uses SLAB, the definition of 'struct kmem_cache' is different and the eBPF program would fetch the wrong field and print garbages. Signed-off-by: Gary Lin --- tools/slabratetop.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/slabratetop.py b/tools/slabratetop.py index 64cecbb9c80b..f1911b094e08 100755 --- a/tools/slabratetop.py +++ b/tools/slabratetop.py @@ -63,7 +63,11 @@ def signal_ignore(signal, frame): #include #include #include +#ifdef CONFIG_SLUB #include +#else +#include +#endif #define CACHE_NAME_SIZE 32