kernel/bpf/core.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
Historically, the classic BPF interpreter distinguished between taken
conditional branches and fall-through paths by using CONT_JMP and CONT,
respectively.
After the interpreter was migrated from net/core/filter.c to
kernel/bpf/core.c, this naming split remained as a historical artifact.
However, both macros have long expanded to the exact same sequence:
"{ insn++; goto select_insn; }".
To simplify the code and remove unnecessary abstractions, replace all
remaining CONT_JMP with CONT, and drop the redundant CONT_JMP definition
entirely.
No functional change intended.
Co-developed-by: Yazhou Tang <tangyazhou518@outlook.com>
Signed-off-by: Yazhou Tang <tangyazhou518@outlook.com>
Co-developed-by: Shenghao Yuan <shenghaoyuan0928@163.com>
Signed-off-by: Shenghao Yuan <shenghaoyuan0928@163.com>
Signed-off-by: Tianci Cao <ziye@zju.edu.cn>
---
kernel/bpf/core.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 229c74f3d6ae..040ce44ba0dd 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -1770,7 +1770,6 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn)
u32 tail_call_cnt = 0;
#define CONT ({ insn++; goto select_insn; })
-#define CONT_JMP ({ insn++; goto select_insn; })
select_insn:
goto *jumptable[insn->code];
@@ -2089,25 +2088,25 @@ static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn)
JMP_##OPCODE##_X: \
if ((SIGN##64) DST CMP_OP (SIGN##64) SRC) { \
insn += insn->off; \
- CONT_JMP; \
+ CONT; \
} \
CONT; \
JMP32_##OPCODE##_X: \
if ((SIGN##32) DST CMP_OP (SIGN##32) SRC) { \
insn += insn->off; \
- CONT_JMP; \
+ CONT; \
} \
CONT; \
JMP_##OPCODE##_K: \
if ((SIGN##64) DST CMP_OP (SIGN##64) IMM) { \
insn += insn->off; \
- CONT_JMP; \
+ CONT; \
} \
CONT; \
JMP32_##OPCODE##_K: \
if ((SIGN##32) DST CMP_OP (SIGN##32) IMM) { \
insn += insn->off; \
- CONT_JMP; \
+ CONT; \
} \
CONT;
COND_JMP(u, JEQ, ==)
--
2.34.1
On Mon, Mar 23, 2026 at 2:05 AM Tianci Cao <ziye@zju.edu.cn> wrote:
>
> Historically, the classic BPF interpreter distinguished between taken
> conditional branches and fall-through paths by using CONT_JMP and CONT,
> respectively.
>
> After the interpreter was migrated from net/core/filter.c to
> kernel/bpf/core.c, this naming split remained as a historical artifact.
> However, both macros have long expanded to the exact same sequence:
> "{ insn++; goto select_insn; }".
It was like this for years and can stay as-is for historical reasons.
pw-bot: cr
On Mon, Mar 23, 2026 at 08:22:52AM -0700, Alexei Starovoitov wrote: > It was like this for years and can stay as-is for historical reasons. Thanks for the review and the explanation. I understand. I'll leave it as-is and keep this in mind for future cleanup patches. Thanks, Tianci Co-developed-by: Yazhou Tang <tangyazhou518@outlook.com> Signed-off-by: Yazhou Tang <tangyazhou518@outlook.com> Co-developed-by: Shenghao Yuan <shenghaoyuan0928@163.com> Signed-off-by: Shenghao Yuan <shenghaoyuan0928@163.com> Signed-off-by: Tianci Cao <ziye@zju.edu.cn>
© 2016 - 2026 Red Hat, Inc.