Explicitly create stack-trace tables with size of power of two
@@ -20,6 +20,7 @@ R"********(
#include <uapi/linux/bpf.h>
#include <uapi/linux/if_packet.h>
#include <linux/version.h>
+#include <linux/log2.h>
#ifndef CONFIG_BPF_SYSCALL
#error "CONFIG_BPF_SYSCALL is undefined, please check your .config or ask your Linux distro to enable this feature"
@@ -184,7 +185,7 @@ struct bpf_stacktrace {
};
#define BPF_STACK_TRACE(_name, _max_entries) \
- BPF_TABLE("stacktrace", int, struct bpf_stacktrace, _name, _max_entries)
+ BPF_TABLE("stacktrace", int, struct bpf_stacktrace, _name, roundup_pow_of_two(_max_entries))
#define BPF_PROG_ARRAY(_name, _max_entries) \
BPF_TABLE("prog", u32, u32, _name, _max_entries)
