diff options
author | Alexei Starovoitov <ast@kernel.org> | 2021-02-10 04:36:27 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2021-02-11 16:18:55 +0100 |
commit | 031d6e02ddbb8dea747c1abb697d556901f07dd4 (patch) | |
tree | 2a4acbda0c22f3a2df375ed31a4123e5f2bd761a /kernel/bpf/trampoline.c | |
parent | bpf: Optimize program stats (diff) | |
download | linux-031d6e02ddbb8dea747c1abb697d556901f07dd4.tar.xz linux-031d6e02ddbb8dea747c1abb697d556901f07dd4.zip |
bpf: Run sleepable programs with migration disabled
In older non-RT kernels migrate_disable() was the same as preempt_disable().
Since commit 74d862b682f5 ("sched: Make migrate_disable/enable() independent of RT")
migrate_disable() is real and doesn't prevent sleeping.
Running sleepable programs with migration disabled allows to add support for
program stats and per-cpu maps later.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: KP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20210210033634.62081-3-alexei.starovoitov@gmail.com
Diffstat (limited to 'kernel/bpf/trampoline.c')
-rw-r--r-- | kernel/bpf/trampoline.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/bpf/trampoline.c b/kernel/bpf/trampoline.c index 5be3beeedd74..89fc849ba271 100644 --- a/kernel/bpf/trampoline.c +++ b/kernel/bpf/trampoline.c @@ -425,11 +425,13 @@ void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start) void notrace __bpf_prog_enter_sleepable(void) { rcu_read_lock_trace(); + migrate_disable(); might_fault(); } void notrace __bpf_prog_exit_sleepable(void) { + migrate_enable(); rcu_read_unlock_trace(); } |