Message ID | 20221230041151.1231169-6-houtao@huaweicloud.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | BPF |
Headers | show |
Series | bpf: Handle reuse in bpf memory alloc | expand |
diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c index 623111d4276d..e1636c5d0051 100644 --- a/kernel/bpf/hashtab.c +++ b/kernel/bpf/hashtab.c @@ -574,14 +574,14 @@ static struct bpf_map *htab_map_alloc(union bpf_attr *attr) goto free_prealloc; } } else { - err = bpf_mem_alloc_init(&htab->ma, htab->elem_size, 0, + err = bpf_mem_alloc_init(&htab->ma, htab->elem_size, BPF_MA_NO_REUSE, htab_elem_ctor); if (err) goto free_map_locked; if (percpu) { err = bpf_mem_alloc_init(&htab->pcpu_ma, round_up(htab->map.value_size, 8), - BPF_MA_PERCPU, NULL); + BPF_MA_PERCPU | BPF_MA_NO_REUSE, NULL); if (err) goto free_map_locked; }