aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2016-06-28 06:18:23 -0400
committerDavid S. Miller <davem@davemloft.net>2016-06-30 05:54:40 -0400
commit1ca1cc98bf7418c680415bfce05699f67510a7fd (patch)
treec7f9924f35a3645b99208534b887c84077cfb975 /kernel/bpf
parentee58b57100ca953da7320c285315a95db2f7053d (diff)
bpf: minor cleanups on fd maps and helpers
Some minor cleanups: i) Remove the unlikely() from fd array map lookups and let the CPU branch predictor do its job, scenarios where there is not always a map entry are very well valid. ii) Move the attribute type check in the bpf_perf_event_read() helper a bit earlier so it's consistent wrt checks with bpf_perf_event_output() helper as well. iii) remove some comments that are self-documenting in kprobe_prog_is_valid_access() and therefore make it consistent to tp_prog_is_valid_access() as well. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r--kernel/bpf/core.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index b94a36550591..d638062f66d6 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -719,14 +719,13 @@ select_insn:
719 719
720 if (unlikely(index >= array->map.max_entries)) 720 if (unlikely(index >= array->map.max_entries))
721 goto out; 721 goto out;
722
723 if (unlikely(tail_call_cnt > MAX_TAIL_CALL_CNT)) 722 if (unlikely(tail_call_cnt > MAX_TAIL_CALL_CNT))
724 goto out; 723 goto out;
725 724
726 tail_call_cnt++; 725 tail_call_cnt++;
727 726
728 prog = READ_ONCE(array->ptrs[index]); 727 prog = READ_ONCE(array->ptrs[index]);
729 if (unlikely(!prog)) 728 if (!prog)
730 goto out; 729 goto out;
731 730
732 /* ARG1 at this point is guaranteed to point to CTX from 731 /* ARG1 at this point is guaranteed to point to CTX from