]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: Remove migrate_{disable|enable} in htab_elem_free
authorHou Tao <houtao1@huawei.com>
Wed, 8 Jan 2025 01:07:15 +0000 (09:07 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 9 Jan 2025 02:06:36 +0000 (18:06 -0800)
commit53f2ba0b1cc087a597b43e63d35f355e9348bd61
tree433437f4dd8f201970d429b4c144f5607f5a3742
parentea5b229630a631ee6a72e1f58bc40029efc1daf8
bpf: Remove migrate_{disable|enable} in htab_elem_free

htab_elem_free() has two call-sites: delete_all_elements() has already
disabled migration, free_htab_elem() is invoked by other 4 functions:
__htab_map_lookup_and_delete_elem, __htab_map_lookup_and_delete_batch,
htab_map_update_elem and htab_map_delete_elem.

BPF syscall has already disabled migration before invoking
->map_update_elem, ->map_delete_elem, and ->map_lookup_and_delete_elem
callbacks for hash map. __htab_map_lookup_and_delete_batch() also
disables migration before invoking free_htab_elem(). ->map_update_elem()
and ->map_delete_elem() of hash map may be invoked by BPF program and
the running context of BPF program has already disabled migration.
Therefore, it is safe to remove the migration_{disable|enable} pair in
htab_elem_free()

Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20250108010728.207536-4-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/hashtab.c