projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
samples/bpf: update tracex[23] examples to use per-cpu maps
[deliverable/linux.git]
/
samples
/
bpf
/
tracex3_kern.c
diff --git
a/samples/bpf/tracex3_kern.c
b/samples/bpf/tracex3_kern.c
index bf337fbb09472cbe32bfbaff2d4313b7cafb58c6..9974c3d7c18b90f5850e87822a158c90e2645b8d 100644
(file)
--- 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
*/
/* 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);
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 = {
#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,
};
.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);
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)
value = bpf_map_lookup_elem(&lat_map, &index);
if (value)
-
__sync_fetch_and_add((long *)value, 1)
;
+
*value += 1
;
return 0;
}
return 0;
}
This page took
0.032567 seconds
and
5
git commands to generate.