Skip to content

Commit

Permalink
slabratetop: Add memcg_cache_params struct def
Browse files Browse the repository at this point in the history
struct memcg_cache_params moved from include/linux/slab.h to
mm/slab.h in kernel v5.4, causing a compiler error when including
slub_def.h or slab_def.h in slabratetop's bpf program.

It has been removed completely from kernel version 5.9.

Add an empty memcg_cache_params struct in slabratetop's bpf
program so it will compile with kernel versions 5.4 to 5.8.
  • Loading branch information
dwrank authored and yonghong-song committed Sep 29, 2020
1 parent af90bd4 commit 788303e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/slabratetop.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,13 @@ def signal_ignore(signal, frame):
bpf_text = """
#include <uapi/linux/ptrace.h>
#include <linux/mm.h>
#include <linux/slab.h>
// memcg_cache_params is a part of kmem_cache, but is not publicly exposed in
// kernel versions 5.4 to 5.8. Define an empty struct for it here to allow the
// bpf program to compile. It has been completely removed in kernel version
// 5.9, but it does not hurt to have it here for versions 5.4 to 5.8.
struct memcg_cache_params {};
#ifdef CONFIG_SLUB
#include <linux/slub_def.h>
#else
Expand Down

0 comments on commit 788303e

Please sign in to comment.