Skip to content

Commit

Permalink
tools/slabratetop: detect the current memory allocator
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
lcp committed Mar 14, 2018
1 parent 7cfb73b commit fa10345
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/slabratetop.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ def signal_ignore(signal, frame):
#include <uapi/linux/ptrace.h>
#include <linux/mm.h>
#include <linux/slab.h>
#ifdef CONFIG_SLUB
#include <linux/slub_def.h>
#else
#include <linux/slab_def.h>
#endif
#define CACHE_NAME_SIZE 32
Expand Down

0 comments on commit fa10345

Please sign in to comment.