linux/kernel/bpf
Alexei Starovoitov 28fbcfa08d bpf: add array type of eBPF maps
add new map type BPF_MAP_TYPE_ARRAY and its implementation

- optimized for fastest possible lookup()
  . in the future verifier/JIT may recognize lookup() with constant key
    and optimize it into constant pointer. Can optimize non-constant
    key into direct pointer arithmetic as well, since pointers and
    value_size are constant for the life of the eBPF program.
    In other words array_map_lookup_elem() may be 'inlined' by verifier/JIT
    while preserving concurrent access to this map from user space

- two main use cases for array type:
  . 'global' eBPF variables: array of 1 element with key=0 and value is a
    collection of 'global' variables which programs can use to keep the state
    between events
  . aggregation of tracing events into fixed set of buckets

- all array elements pre-allocated and zero initialized at init time

- key as an index in array and can only be 4 byte

- map_delete_elem() returns EINVAL, since elements cannot be deleted

- map_update_elem() replaces elements in an non-atomic way
  (for atomic updates hashtable type should be used instead)

Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2014-11-18 13:43:59 -05:00
..
arraymap.c bpf: add array type of eBPF maps 2014-11-18 13:43:59 -05:00
core.c bpf: split eBPF out of NET 2014-10-27 19:09:59 -04:00
hashtab.c bpf: add hashtable type of eBPF maps 2014-11-18 13:43:25 -05:00
Makefile bpf: add array type of eBPF maps 2014-11-18 13:43:59 -05:00
syscall.c bpf: add 'flags' attribute to BPF_MAP_UPDATE_ELEM command 2014-11-18 13:43:25 -05:00
test_stub.c bpf: mini eBPF library, test stubs and verifier testsuite 2014-09-26 15:05:15 -04:00
verifier.c bpf: reduce verifier memory consumption 2014-10-30 15:44:37 -04:00