Skip to content

Commit ac8b65b

Browse files
image-dragonKernel Patches Daemon
authored andcommitted
bpf: use rcu_migrate_* for trampoline.c
Replace the migrate_disable/migrate_enable with rcu_migrate_disable/rcu_migrate_enable in trampoline.c to obtain better performance when PREEMPT_RCU is not enabled. Signed-off-by: Menglong Dong <[email protected]>
1 parent 85bdff2 commit ac8b65b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kernel/bpf/trampoline.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,7 @@ static u64 notrace __bpf_prog_enter_recur(struct bpf_prog *prog, struct bpf_tram
900900
__acquires(RCU)
901901
{
902902
rcu_read_lock();
903-
migrate_disable();
903+
rcu_migrate_disable();
904904

905905
run_ctx->saved_run_ctx = bpf_set_run_ctx(&run_ctx->run_ctx);
906906

@@ -949,7 +949,7 @@ static void notrace __bpf_prog_exit_recur(struct bpf_prog *prog, u64 start,
949949

950950
update_prog_stats(prog, start);
951951
this_cpu_dec(*(prog->active));
952-
migrate_enable();
952+
rcu_migrate_enable();
953953
rcu_read_unlock();
954954
}
955955

@@ -961,7 +961,7 @@ static u64 notrace __bpf_prog_enter_lsm_cgroup(struct bpf_prog *prog,
961961
* programs, not the shims.
962962
*/
963963
rcu_read_lock();
964-
migrate_disable();
964+
rcu_migrate_disable();
965965

966966
run_ctx->saved_run_ctx = bpf_set_run_ctx(&run_ctx->run_ctx);
967967

@@ -974,7 +974,7 @@ static void notrace __bpf_prog_exit_lsm_cgroup(struct bpf_prog *prog, u64 start,
974974
{
975975
bpf_reset_run_ctx(run_ctx->saved_run_ctx);
976976

977-
migrate_enable();
977+
rcu_migrate_enable();
978978
rcu_read_unlock();
979979
}
980980

@@ -1034,7 +1034,7 @@ static u64 notrace __bpf_prog_enter(struct bpf_prog *prog,
10341034
__acquires(RCU)
10351035
{
10361036
rcu_read_lock();
1037-
migrate_disable();
1037+
rcu_migrate_disable();
10381038

10391039
run_ctx->saved_run_ctx = bpf_set_run_ctx(&run_ctx->run_ctx);
10401040

@@ -1048,7 +1048,7 @@ static void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start,
10481048
bpf_reset_run_ctx(run_ctx->saved_run_ctx);
10491049

10501050
update_prog_stats(prog, start);
1051-
migrate_enable();
1051+
rcu_migrate_enable();
10521052
rcu_read_unlock();
10531053
}
10541054

0 commit comments

Comments
 (0)