]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
bpf: Remove migrate_{disable|enable} from bpf_selem_alloc()
authorHou Tao <houtao1@huawei.com>
Wed, 8 Jan 2025 01:07:25 +0000 (09:07 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 9 Jan 2025 02:06:37 +0000 (18:06 -0800)
bpf_selem_alloc() has two callers:
(1) bpf_sk_storage_clone_elem()
bpf_sk_storage_clone() has already disabled migration before invoking
bpf_sk_storage_clone_elem().

(2) bpf_local_storage_update()
Its callers include: cgrp/task/inode/sock storage ->map_update_elem()
callbacks and bpf_{cgrp|task|inode|sk}_storage_get() helpers. These
running contexts have already disabled migration

Therefore, there is no need to add extra migrate_{disable|enable} pair
in bpf_selem_alloc().

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

index 12cf6382175e1e36e28dca255a39e5a9971eb074..4b016f29f57e480882c946043244cce78dbf0244 100644 (file)
@@ -81,9 +81,7 @@ bpf_selem_alloc(struct bpf_local_storage_map *smap, void *owner,
                return NULL;
 
        if (smap->bpf_ma) {
-               migrate_disable();
                selem = bpf_mem_cache_alloc_flags(&smap->selem_ma, gfp_flags);
-               migrate_enable();
                if (selem)
                        /* Keep the original bpf_map_kzalloc behavior
                         * before started using the bpf_mem_cache_alloc.