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