diff options
author | Roman Gushchin <guro@fb.com> | 2018-09-28 10:45:36 -0400 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-10-01 10:18:32 -0400 |
commit | 8bad74f9840f87661f20ced3dc80c84ab4fd55a1 (patch) | |
tree | 1ac3ef2547d12f0fd6a232fbc1daac2672537907 /kernel/bpf/syscall.c | |
parent | 5bf7a60b8e70969f65c961d7e2c4eb40eb2c664d (diff) |
bpf: extend cgroup bpf core to allow multiple cgroup storage types
In order to introduce per-cpu cgroup storage, let's generalize
bpf cgroup core to support multiple cgroup storage types.
Potentially, per-node cgroup storage can be added later.
This commit is mostly a formal change that replaces
cgroup_storage pointer with a array of cgroup_storage pointers.
It doesn't actually introduce a new storage type,
it will be done later.
Each bpf program is now able to have one cgroup storage of each type.
Signed-off-by: Roman Gushchin <guro@fb.com>
Acked-by: Song Liu <songliubraving@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index b3c2d09bcf7a..8c91d2b41b1e 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -988,10 +988,15 @@ static int find_prog_type(enum bpf_prog_type type, struct bpf_prog *prog) | |||
988 | /* drop refcnt on maps used by eBPF program and free auxilary data */ | 988 | /* drop refcnt on maps used by eBPF program and free auxilary data */ |
989 | static void free_used_maps(struct bpf_prog_aux *aux) | 989 | static void free_used_maps(struct bpf_prog_aux *aux) |
990 | { | 990 | { |
991 | enum bpf_cgroup_storage_type stype; | ||
991 | int i; | 992 | int i; |
992 | 993 | ||
993 | if (aux->cgroup_storage) | 994 | for_each_cgroup_storage_type(stype) { |
994 | bpf_cgroup_storage_release(aux->prog, aux->cgroup_storage); | 995 | if (!aux->cgroup_storage[stype]) |
996 | continue; | ||
997 | bpf_cgroup_storage_release(aux->prog, | ||
998 | aux->cgroup_storage[stype]); | ||
999 | } | ||
995 | 1000 | ||
996 | for (i = 0; i < aux->used_map_cnt; i++) | 1001 | for (i = 0; i < aux->used_map_cnt; i++) |
997 | bpf_map_put(aux->used_maps[i]); | 1002 | bpf_map_put(aux->used_maps[i]); |