History

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.

Alexei Starovoitov committed 5 years ago

Commit 031d6e01 parent 700d4791 file · +2 −0Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/bpf/trampoline.c+2−0
@@ -425,11 +425,13 @@ void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start) · 424 unmodified lines
425425 void notrace __bpf_prog_enter_sleepable(void)
426426 {
427427 rcu_read_lock_trace();
428+ migrate_disable();
428429 might_fault();
429430 }
430431
431432 void notrace __bpf_prog_exit_sleepable(void)
432433 {
434+ migrate_enable();
433435 rcu_read_unlock_trace();
434436 }
435437

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t