aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/stackmap.c
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2018-04-29 01:28:07 -0400
committerAlexei Starovoitov <ast@kernel.org>2018-04-29 11:45:53 -0400
commit5f4126327494c189767ca64b222abadb07c55e3d (patch)
treeda49fcd3d06c7cd69253d8f7c02da61958457b1f /kernel/bpf/stackmap.c
parent2c25fc9a503adef4279951382fc9d47b59977f59 (diff)
bpf: change prototype for stack_map_get_build_id_offset
This patch didn't incur functionality change. The function prototype got changed so that the same function can be reused later. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/stackmap.c')
-rw-r--r--kernel/bpf/stackmap.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c
index 57eeb1234b67..04f6ec1679f0 100644
--- a/kernel/bpf/stackmap.c
+++ b/kernel/bpf/stackmap.c
@@ -262,16 +262,11 @@ out:
262 return ret; 262 return ret;
263} 263}
264 264
265static void stack_map_get_build_id_offset(struct bpf_map *map, 265static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,
266 struct stack_map_bucket *bucket,
267 u64 *ips, u32 trace_nr, bool user) 266 u64 *ips, u32 trace_nr, bool user)
268{ 267{
269 int i; 268 int i;
270 struct vm_area_struct *vma; 269 struct vm_area_struct *vma;
271 struct bpf_stack_build_id *id_offs;
272
273 bucket->nr = trace_nr;
274 id_offs = (struct bpf_stack_build_id *)bucket->data;
275 270
276 /* 271 /*
277 * We cannot do up_read() in nmi context, so build_id lookup is 272 * We cannot do up_read() in nmi context, so build_id lookup is
@@ -361,8 +356,10 @@ BPF_CALL_3(bpf_get_stackid, struct pt_regs *, regs, struct bpf_map *, map,
361 pcpu_freelist_pop(&smap->freelist); 356 pcpu_freelist_pop(&smap->freelist);
362 if (unlikely(!new_bucket)) 357 if (unlikely(!new_bucket))
363 return -ENOMEM; 358 return -ENOMEM;
364 stack_map_get_build_id_offset(map, new_bucket, ips, 359 new_bucket->nr = trace_nr;
365 trace_nr, user); 360 stack_map_get_build_id_offset(
361 (struct bpf_stack_build_id *)new_bucket->data,
362 ips, trace_nr, user);
366 trace_len = trace_nr * sizeof(struct bpf_stack_build_id); 363 trace_len = trace_nr * sizeof(struct bpf_stack_build_id);
367 if (hash_matches && bucket->nr == trace_nr && 364 if (hash_matches && bucket->nr == trace_nr &&
368 memcmp(bucket->data, new_bucket->data, trace_len) == 0) { 365 memcmp(bucket->data, new_bucket->data, trace_len) == 0) {