diff options
Diffstat (limited to 'include/linux/bpf-cgroup.h')
-rw-r--r-- | include/linux/bpf-cgroup.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index cb3c6b3b89c8..b631ee75762d 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/errno.h> | 6 | #include <linux/errno.h> |
7 | #include <linux/jump_label.h> | 7 | #include <linux/jump_label.h> |
8 | #include <linux/percpu.h> | 8 | #include <linux/percpu.h> |
9 | #include <linux/percpu-refcount.h> | ||
9 | #include <linux/rbtree.h> | 10 | #include <linux/rbtree.h> |
10 | #include <uapi/linux/bpf.h> | 11 | #include <uapi/linux/bpf.h> |
11 | 12 | ||
@@ -71,11 +72,17 @@ struct cgroup_bpf { | |||
71 | u32 flags[MAX_BPF_ATTACH_TYPE]; | 72 | u32 flags[MAX_BPF_ATTACH_TYPE]; |
72 | 73 | ||
73 | /* temp storage for effective prog array used by prog_attach/detach */ | 74 | /* temp storage for effective prog array used by prog_attach/detach */ |
74 | struct bpf_prog_array __rcu *inactive; | 75 | struct bpf_prog_array *inactive; |
76 | |||
77 | /* reference counter used to detach bpf programs after cgroup removal */ | ||
78 | struct percpu_ref refcnt; | ||
79 | |||
80 | /* cgroup_bpf is released using a work queue */ | ||
81 | struct work_struct release_work; | ||
75 | }; | 82 | }; |
76 | 83 | ||
77 | void cgroup_bpf_put(struct cgroup *cgrp); | ||
78 | int cgroup_bpf_inherit(struct cgroup *cgrp); | 84 | int cgroup_bpf_inherit(struct cgroup *cgrp); |
85 | void cgroup_bpf_offline(struct cgroup *cgrp); | ||
79 | 86 | ||
80 | int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, | 87 | int __cgroup_bpf_attach(struct cgroup *cgrp, struct bpf_prog *prog, |
81 | enum bpf_attach_type type, u32 flags); | 88 | enum bpf_attach_type type, u32 flags); |
@@ -283,8 +290,8 @@ int cgroup_bpf_prog_query(const union bpf_attr *attr, | |||
283 | 290 | ||
284 | struct bpf_prog; | 291 | struct bpf_prog; |
285 | struct cgroup_bpf {}; | 292 | struct cgroup_bpf {}; |
286 | static inline void cgroup_bpf_put(struct cgroup *cgrp) {} | ||
287 | static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } | 293 | static inline int cgroup_bpf_inherit(struct cgroup *cgrp) { return 0; } |
294 | static inline void cgroup_bpf_offline(struct cgroup *cgrp) {} | ||
288 | 295 | ||
289 | static inline int cgroup_bpf_prog_attach(const union bpf_attr *attr, | 296 | static inline int cgroup_bpf_prog_attach(const union bpf_attr *attr, |
290 | enum bpf_prog_type ptype, | 297 | enum bpf_prog_type ptype, |