mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 04:23:35 +02:00
bpf: use rcu_read_lock_dont_migrate() for bpf_iter_run_prog()
Use rcu_read_lock_dont_migrate() and rcu_read_unlock_migrate() in bpf_iter_run_prog to obtain better performance when PREEMPT_RCU is not enabled. Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn> Link: https://lore.kernel.org/r/20250821090609.42508-5-dongml2@chinatelecom.cn Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
f2fa9b9069
commit
68748f0397
|
|
@ -705,13 +705,11 @@ int bpf_iter_run_prog(struct bpf_prog *prog, void *ctx)
|
|||
migrate_enable();
|
||||
rcu_read_unlock_trace();
|
||||
} else {
|
||||
rcu_read_lock();
|
||||
migrate_disable();
|
||||
rcu_read_lock_dont_migrate();
|
||||
old_run_ctx = bpf_set_run_ctx(&run_ctx);
|
||||
ret = bpf_prog_run(prog, ctx);
|
||||
bpf_reset_run_ctx(old_run_ctx);
|
||||
migrate_enable();
|
||||
rcu_read_unlock();
|
||||
rcu_read_unlock_migrate();
|
||||
}
|
||||
|
||||
/* bpf program can only return 0 or 1:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user