Skip to content

Commit 7dcc42b

Browse files
4astdavem330
authored andcommitted
samples/bpf: stress test bpf_get_stackid
increase stress by also calling bpf_get_stackid() from various *spin* functions Signed-off-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9d8b612 commit 7dcc42b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

samples/bpf/spintest_kern.c

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/netdevice.h>
99
#include <linux/version.h>
1010
#include <uapi/linux/bpf.h>
11+
#include <uapi/linux/perf_event.h>
1112
#include "bpf_helpers.h"
1213

1314
struct bpf_map_def SEC("maps") my_map = {
@@ -23,6 +24,13 @@ struct bpf_map_def SEC("maps") my_map2 = {
2324
.max_entries = 1024,
2425
};
2526

27+
struct bpf_map_def SEC("maps") stackmap = {
28+
.type = BPF_MAP_TYPE_STACK_TRACE,
29+
.key_size = sizeof(u32),
30+
.value_size = PERF_MAX_STACK_DEPTH * sizeof(u64),
31+
.max_entries = 10000,
32+
};
33+
2634
#define PROG(foo) \
2735
int foo(struct pt_regs *ctx) \
2836
{ \
@@ -32,6 +40,7 @@ int foo(struct pt_regs *ctx) \
3240
bpf_map_update_elem(&my_map, &v, &v, BPF_ANY); \
3341
bpf_map_update_elem(&my_map2, &v, &v, BPF_ANY); \
3442
bpf_map_delete_elem(&my_map2, &v); \
43+
bpf_get_stackid(ctx, &stackmap, BPF_F_REUSE_STACKID); \
3544
return 0; \
3645
}
3746

0 commit comments

Comments
 (0)