Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1353470 > unrolled thread

[PATCH net-next 2/3] samples/bpf: stress test bpf_get_stackid

Started byAlexei Starovoitov <ast@fb.com>
First post2016-03-09 00:10 +0100
Last post2016-03-09 05:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH net-next 2/3] samples/bpf: stress test bpf_get_stackid Alexei Starovoitov <ast@fb.com> - 2016-03-09 00:10 +0100
    Re: [PATCH net-next 2/3] samples/bpf: stress test bpf_get_stackid David Miller <davem@davemloft.net> - 2016-03-09 05:30 +0100

#1353470 — [PATCH net-next 2/3] samples/bpf: stress test bpf_get_stackid

FromAlexei Starovoitov <ast@fb.com>
Date2016-03-09 00:10 +0100
Subject[PATCH net-next 2/3] samples/bpf: stress test bpf_get_stackid
Message-ID<rayVk-7EC-17@gated-at.bofh.it>
increase stress by also calling bpf_get_stackid() from
various *spin* functions

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
 samples/bpf/spintest_kern.c | 9 +++++++++
 1 file changed, 9 insertions(+)

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; \
 }
 
-- 
2.8.0.rc1

[toc] | [next] | [standalone]


#1353789

FromDavid Miller <davem@davemloft.net>
Date2016-03-09 05:30 +0100
Message-ID<raDV0-2C5-17@gated-at.bofh.it>
In reply to#1353470
From: Alexei Starovoitov <ast@fb.com>
Date: Tue, 8 Mar 2016 15:07:53 -0800

> increase stress by also calling bpf_get_stackid() from
> various *spin* functions
> 
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web