Skip to content

Commit cbddcb5

Browse files
Roman GushchinAlexei Starovoitov
authored andcommitted
bpf: Eliminate rlimit-based memory accounting for lpm_trie maps
Do not use rlimit-based memory accounting for lpm_trie maps. It has been replaced with the memcg-based memory accounting. Signed-off-by: Roman Gushchin <guro@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Song Liu <songliubraving@fb.com> Link: https://lore.kernel.org/bpf/20201201215900.3569844-25-guro@fb.com
1 parent 755e5d5 commit cbddcb5

1 file changed

Lines changed: 0 additions & 13 deletions

File tree

‎kernel/bpf/lpm_trie.c‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,6 @@ static int trie_delete_elem(struct bpf_map *map, void *_key)
540540
static struct bpf_map *trie_alloc(union bpf_attr *attr)
541541
{
542542
struct lpm_trie *trie;
543-
u64 cost = sizeof(*trie), cost_per_node;
544-
int ret;
545543

546544
if (!bpf_capable())
547545
return ERR_PTR(-EPERM);
@@ -567,20 +565,9 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr)
567565
offsetof(struct bpf_lpm_trie_key, data);
568566
trie->max_prefixlen = trie->data_size * 8;
569567

570-
cost_per_node = sizeof(struct lpm_trie_node) +
571-
attr->value_size + trie->data_size;
572-
cost += (u64) attr->max_entries * cost_per_node;
573-
574-
ret = bpf_map_charge_init(&trie->map.memory, cost);
575-
if (ret)
576-
goto out_err;
577-
578568
spin_lock_init(&trie->lock);
579569

580570
return &trie->map;
581-
out_err:
582-
kfree(trie);
583-
return ERR_PTR(ret);
584571
}
585572

586573
static void trie_free(struct bpf_map *map)

0 commit comments

Comments
 (0)