Skip to content

Commit

Permalink
bpf: Add BPF_MAP_TYPE_LRU_HASH
Browse files Browse the repository at this point in the history
Provide a LRU version of the existing BPF_MAP_TYPE_HASH.

Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
iamkafai authored and davem330 committed Nov 15, 2016
1 parent fd91de7 commit 29ba732
Show file tree
Hide file tree
Showing 2 changed files with 260 additions and 14 deletions.
8 changes: 8 additions & 0 deletions include/uapi/linux/bpf.h
Expand Up @@ -85,6 +85,7 @@ enum bpf_map_type {
BPF_MAP_TYPE_PERCPU_ARRAY,
BPF_MAP_TYPE_STACK_TRACE,
BPF_MAP_TYPE_CGROUP_ARRAY,
BPF_MAP_TYPE_LRU_HASH,
};

enum bpf_prog_type {
Expand All @@ -106,6 +107,13 @@ enum bpf_prog_type {
#define BPF_EXIST 2 /* update existing element */

#define BPF_F_NO_PREALLOC (1U << 0)
/* 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)

union bpf_attr {
struct { /* anonymous struct used by BPF_MAP_CREATE command */
Expand Down

0 comments on commit 29ba732

Please sign in to comment.