From 3059303f59cf90a84e7fdef154ff0b215bcfaa97 Mon Sep 17 00:00:00 2001 From: Alexei Starovoitov Date: Mon, 1 Feb 2016 22:39:58 -0800 Subject: samples/bpf: update tracex[23] examples to use per-cpu maps Signed-off-by: Alexei Starovoitov Signed-off-by: David S. Miller --- samples/bpf/tracex3_kern.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'samples/bpf/tracex3_kern.c') 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; } -- cgit v1.2.1