[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW5VxGQfDRVU6hH6xj4qU7p0hpmupvLnpE9fgexdK8D+rQ@mail.gmail.com>
Date: Mon, 27 Jul 2020 22:32:35 -0700
From: Song Liu <song@...nel.org>
To: Roman Gushchin <guro@...com>
Cc: bpf <bpf@...r.kernel.org>, Networking <netdev@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH bpf-next v2 19/35] bpf: eliminate rlimit-based memory
accounting for lpm_trie maps
On Mon, Jul 27, 2020 at 12:25 PM Roman Gushchin <guro@...com> wrote:
>
> 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@...com>
Acked-by: Song Liu <songliubraving@...com>
> ---
> kernel/bpf/lpm_trie.c | 13 -------------
> 1 file changed, 13 deletions(-)
>
> diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c
> index d85e0fc2cafc..c747f0835eb1 100644
> --- a/kernel/bpf/lpm_trie.c
> +++ b/kernel/bpf/lpm_trie.c
> @@ -540,8 +540,6 @@ static int trie_delete_elem(struct bpf_map *map, void *_key)
> static struct bpf_map *trie_alloc(union bpf_attr *attr)
> {
> struct lpm_trie *trie;
> - u64 cost = sizeof(*trie), cost_per_node;
> - int ret;
>
> if (!bpf_capable())
> return ERR_PTR(-EPERM);
> @@ -567,20 +565,9 @@ static struct bpf_map *trie_alloc(union bpf_attr *attr)
> offsetof(struct bpf_lpm_trie_key, data);
> trie->max_prefixlen = trie->data_size * 8;
>
> - cost_per_node = sizeof(struct lpm_trie_node) +
> - attr->value_size + trie->data_size;
> - cost += (u64) attr->max_entries * cost_per_node;
> -
> - ret = bpf_map_charge_init(&trie->map.memory, cost);
> - if (ret)
> - goto out_err;
> -
> spin_lock_init(&trie->lock);
>
> return &trie->map;
> -out_err:
> - kfree(trie);
> - return ERR_PTR(ret);
> }
>
> static void trie_free(struct bpf_map *map)
> --
> 2.26.2
>
Powered by blists - more mailing lists