diff options
author | Alexei Starovoitov <ast@fb.com> | 2016-02-02 07:39:58 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-06 09:34:36 +0100 |
commit | 3059303f59cf90a84e7fdef154ff0b215bcfaa97 (patch) | |
tree | bacdf1b8025256fc591b1fd935a99f0b6af7466f /samples/bpf/tracex3_kern.c | |
parent | samples/bpf: unit test for BPF_MAP_TYPE_PERCPU_ARRAY (diff) | |
download | linux-3059303f59cf90a84e7fdef154ff0b215bcfaa97.tar.xz linux-3059303f59cf90a84e7fdef154ff0b215bcfaa97.zip |
samples/bpf: update tracex[23] examples to use per-cpu maps
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'samples/bpf/tracex3_kern.c')
-rw-r--r-- | samples/bpf/tracex3_kern.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/samples/bpf/tracex3_kern.c b/samples/bpf/tracex3_kern.c index bf337fbb0947..9974c3d7c18b 100644 --- a/samples/bpf/tracex3_kern.c +++ b/samples/bpf/tracex3_kern.c @@ -20,7 +20,7 @@ struct bpf_map_def SEC("maps") my_map = { /* kprobe is NOT a stable ABI. If kernel internals change this bpf+kprobe * example will no longer be meaningful */ -SEC("kprobe/blk_mq_start_request") +SEC("kprobe/blk_start_request") int bpf_prog1(struct pt_regs *ctx) { long rq = PT_REGS_PARM1(ctx); @@ -42,13 +42,13 @@ static unsigned int log2l(unsigned long long n) #define SLOTS 100 struct bpf_map_def SEC("maps") lat_map = { - .type = BPF_MAP_TYPE_ARRAY, + .type = BPF_MAP_TYPE_PERCPU_ARRAY, .key_size = sizeof(u32), .value_size = sizeof(u64), .max_entries = SLOTS, }; -SEC("kprobe/blk_update_request") +SEC("kprobe/blk_account_io_completion") int bpf_prog2(struct pt_regs *ctx) { long rq = PT_REGS_PARM1(ctx); @@ -81,7 +81,7 @@ int bpf_prog2(struct pt_regs *ctx) value = bpf_map_lookup_elem(&lat_map, &index); if (value) - __sync_fetch_and_add((long *)value, 1); + *value += 1; return 0; } |