Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lwt_bpf: Replace preempt_disable() with migrate_disable()

migrate_disable() is just a wrapper for preempt_disable() in
non-RT kernel. It is safe to replace it, and RT kernel will
benefit.

Note that it is introduced since Feb 2020.

Suggested-by: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Signed-off-by: Cong Wang <cong.wang@bytedance.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201205075946.497763-2-xiyou.wangcong@gmail.com

authored by

Cong Wang and committed by
Alexei Starovoitov
e3366884 d9054a1f

+3 -3
+3 -3
net/core/lwt_bpf.c
··· 39 39 { 40 40 int ret; 41 41 42 - /* Preempt disable and BH disable are needed to protect per-cpu 42 + /* Migration disable and BH disable are needed to protect per-cpu 43 43 * redirect_info between BPF prog and skb_do_redirect(). 44 44 */ 45 - preempt_disable(); 45 + migrate_disable(); 46 46 local_bh_disable(); 47 47 bpf_compute_data_pointers(skb); 48 48 ret = bpf_prog_run_save_cb(lwt->prog, skb); ··· 78 78 } 79 79 80 80 local_bh_enable(); 81 - preempt_enable(); 81 + migrate_enable(); 82 82 83 83 return ret; 84 84 }