[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161114205222.GA1655@ast-mbp.thefacebook.com>
Date: Mon, 14 Nov 2016 12:52:23 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Martin KaFai Lau <kafai@...com>
Cc: netdev@...r.kernel.org, David Miller <davem@...emloft.net>,
Alexei Starovoitov <ast@...com>,
Daniel Borkmann <daniel@...earbox.net>,
Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v2 net-next 4/6] bpf: Add BPF_MAP_TYPE_LRU_HASH
On Fri, Nov 11, 2016 at 10:55:09AM -0800, Martin KaFai Lau wrote:
> Provide a LRU version of the existing BPF_MAP_TYPE_HASH.
>
> Signed-off-by: Martin KaFai Lau <kafai@...com>
...
> +/* Instead of having one common LRU list in the
> + * BPF_MAP_TYPE_LRU_HASH map, use a percpu LRU list
> + * which can scale and perform better.
> + * Note, the LRU nodes (including free nodes) cannot be moved
> + * across different LRU lists.
> + */
> +#define BPF_F_NO_COMMON_LRU (1U << 1)
I couldn't come up with better name, so I think it's good :)
> + if (lru && !capable(CAP_SYS_ADMIN))
> + /* LRU implementation is much complicated than other
> + * maps. Hence, limit to CAP_SYS_ADMIN for now.
> + */
> + return ERR_PTR(-EPERM);
+1
good call.
> + if (!percpu && !lru) {
> + /* lru itself can remove the least used element, so
> + * there is no need for an extra elem during map_update.
> + */
yeah. that's an important comment, otherwise
@@ -48,11 +52,19 @@ struct htab_elem {
union {
struct rcu_head rcu;
enum extra_elem_state state;
+ struct bpf_lru_node lru_node;
};
wouldn't be correct.
Acked-by: Alexei Starovoitov <ast@...nel.org>
Powered by blists - more mailing lists