diff options
author | Hou Tao <houtao1@huawei.com> | 2025-01-08 09:07:26 +0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2025-01-08 18:06:37 -0800 |
commit | 4855a75ebf485f74b06ba85b16b71c4b71a4086d (patch) | |
tree | a0f5fd1c3e0f60a58e978c5966ef97a276df690b | |
parent | 2269b32ab00e1be663b838a1eed14408cb9ba677 (diff) |
bpf: Remove migrate_{disable|enable} from bpf_local_storage_alloc()
These two callers of bpf_local_storage_alloc() are the same as
bpf_selem_alloc(): bpf_sk_storage_clone() and
bpf_local_storage_update(). The running contexts of these two callers
have already disabled migration, therefore, there is no need to add
extra migrate_{disable|enable} pair in bpf_local_storage_alloc().
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20250108010728.207536-15-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r-- | kernel/bpf/bpf_local_storage.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c index 4b016f29f57e..d78d53b92118 100644 --- a/kernel/bpf/bpf_local_storage.c +++ b/kernel/bpf/bpf_local_storage.c @@ -498,15 +498,11 @@ int bpf_local_storage_alloc(void *owner, if (err) return err; - if (smap->bpf_ma) { - migrate_disable(); + if (smap->bpf_ma) storage = bpf_mem_cache_alloc_flags(&smap->storage_ma, gfp_flags); - migrate_enable(); - } else { + else storage = bpf_map_kzalloc(&smap->map, sizeof(*storage), gfp_flags | __GFP_NOWARN); - } - if (!storage) { err = -ENOMEM; goto uncharge; |