summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@fb.com>2016-03-09 00:07:53 +0100
committerDavid S. Miller <davem@davemloft.net>2016-03-09 05:22:02 +0100
commit7dcc42b685b4acf7b2f3f08d157f1574e1bec7f7 (patch)
tree7893ae0c100e957d8a172551c2d07c8e1eba48ac /samples
parentsamples/bpf: add bpf map stress test (diff)
downloadlinux-7dcc42b685b4acf7b2f3f08d157f1574e1bec7f7.tar.xz
linux-7dcc42b685b4acf7b2f3f08d157f1574e1bec7f7.zip
samples/bpf: stress test bpf_get_stackid
increase stress by also calling bpf_get_stackid() from various *spin* functions Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples')
-rw-r--r--samples/bpf/spintest_kern.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/samples/bpf/spintest_kern.c b/samples/bpf/spintest_kern.c
index ef8ac33bb2e9..4b27619d91a4 100644
--- a/samples/bpf/spintest_kern.c
+++ b/samples/bpf/spintest_kern.c
@@ -8,6 +8,7 @@
#include <linux/netdevice.h>
#include <linux/version.h>
#include <uapi/linux/bpf.h>
+#include <uapi/linux/perf_event.h>
#include "bpf_helpers.h"
struct bpf_map_def SEC("maps") my_map = {
@@ -23,6 +24,13 @@ struct bpf_map_def SEC("maps") my_map2 = {
.max_entries = 1024,
};
+struct bpf_map_def SEC("maps") stackmap = {
+ .type = BPF_MAP_TYPE_STACK_TRACE,
+ .key_size = sizeof(u32),
+ .value_size = PERF_MAX_STACK_DEPTH * sizeof(u64),
+ .max_entries = 10000,
+};
+
#define PROG(foo) \
int foo(struct pt_regs *ctx) \
{ \
@@ -32,6 +40,7 @@ int foo(struct pt_regs *ctx) \
bpf_map_update_elem(&my_map, &v, &v, BPF_ANY); \
bpf_map_update_elem(&my_map2, &v, &v, BPF_ANY); \
bpf_map_delete_elem(&my_map2, &v); \
+ bpf_get_stackid(ctx, &stackmap, BPF_F_REUSE_STACKID); \
return 0; \
}