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.
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -425,11 +425,13 @@ void notrace __bpf_prog_exit(struct bpf_prog *prog, u64 start) · 424 unmodified lines | |||
| 425 | void notrace __bpf_prog_enter_sleepable(void) | 425 | void notrace __bpf_prog_enter_sleepable(void) |
| 426 | { | 426 | { |
| 427 | rcu_read_lock_trace(); | 427 | rcu_read_lock_trace(); |
| 428 | migrate_disable(); | ||
| 428 | might_fault(); | 429 | might_fault(); |
| 429 | } | 430 | } |
| 430 | 431 | ||
| 431 | void notrace __bpf_prog_exit_sleepable(void) | 432 | void notrace __bpf_prog_exit_sleepable(void) |
| 432 | { | 433 | { |
| 434 | migrate_enable(); | ||
| 433 | rcu_read_unlock_trace(); | 435 | rcu_read_unlock_trace(); |
| 434 | } | 436 | } |
| 435 | 437 | ||