mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 11:37:47 +00:00
bpf: Remove migrate_{disable|enable} from bpf_local_storage_free()
bpf_local_storage_free() has three callers: 1) bpf_local_storage_alloc() Its caller must have disabled migration. 2) bpf_local_storage_destroy() Its four callers (bpf_{cgrp|inode|task|sk}_storage_free()) have already invoked migrate_disable() before invoking bpf_local_storage_destroy(). 3) bpf_selem_unlink() Its callers include: cgrp/inode/task/sk storage ->map_delete_elem callbacks, bpf_{cgrp|inode|task|sk}_storage_delete() helpers and bpf_local_storage_map_free(). All of these callers have already disabled migration before invoking bpf_selem_unlink(). Therefore, it is OK to remove migrate_{disable|enable} pair from bpf_local_storage_free(). Signed-off-by: Hou Tao <houtao1@huawei.com> Link: https://lore.kernel.org/r/20250108010728.207536-16-houtao@huaweicloud.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
4855a75ebf
commit
7b984359e0
@ -172,17 +172,14 @@ static void bpf_local_storage_free(struct bpf_local_storage *local_storage,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smap) {
|
if (smap)
|
||||||
migrate_disable();
|
|
||||||
bpf_mem_cache_free(&smap->storage_ma, local_storage);
|
bpf_mem_cache_free(&smap->storage_ma, local_storage);
|
||||||
migrate_enable();
|
else
|
||||||
} else {
|
|
||||||
/* smap could be NULL if the selem that triggered
|
/* smap could be NULL if the selem that triggered
|
||||||
* this 'local_storage' creation had been long gone.
|
* this 'local_storage' creation had been long gone.
|
||||||
* In this case, directly do call_rcu().
|
* In this case, directly do call_rcu().
|
||||||
*/
|
*/
|
||||||
call_rcu(&local_storage->rcu, bpf_local_storage_free_rcu);
|
call_rcu(&local_storage->rcu, bpf_local_storage_free_rcu);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rcu tasks trace callback for bpf_ma == false */
|
/* rcu tasks trace callback for bpf_ma == false */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user