diff options
| author | Daniel Borkmann <daniel@iogearbox.net> | 2015-03-01 06:31:47 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2015-03-01 14:05:19 -0500 |
| commit | 24701ecea76b0b93bd9667486934ec310825f558 (patch) | |
| tree | 7f658077fea363e89643d95fc808236d748b8431 /include | |
| parent | 96be4325f443dbbfeb37d2a157675ac0736531a1 (diff) | |
ebpf: move read-only fields to bpf_prog and shrink bpf_prog_aux
is_gpl_compatible and prog_type should be moved directly into bpf_prog
as they stay immutable during bpf_prog's lifetime, are core attributes
and they can be locked as read-only later on via bpf_prog_select_runtime().
With a bit of rearranging, this also allows us to shrink bpf_prog_aux
to exactly 1 cacheline.
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/bpf.h | 4 | ||||
| -rw-r--r-- | include/linux/filter.h | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 9c458144cdb4..a1a7ff2df328 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h | |||
| @@ -117,11 +117,9 @@ struct bpf_prog; | |||
| 117 | 117 | ||
| 118 | struct bpf_prog_aux { | 118 | struct bpf_prog_aux { |
| 119 | atomic_t refcnt; | 119 | atomic_t refcnt; |
| 120 | bool is_gpl_compatible; | 120 | u32 used_map_cnt; |
| 121 | enum bpf_prog_type prog_type; | ||
| 122 | const struct bpf_verifier_ops *ops; | 121 | const struct bpf_verifier_ops *ops; |
| 123 | struct bpf_map **used_maps; | 122 | struct bpf_map **used_maps; |
| 124 | u32 used_map_cnt; | ||
| 125 | struct bpf_prog *prog; | 123 | struct bpf_prog *prog; |
| 126 | struct work_struct work; | 124 | struct work_struct work; |
| 127 | }; | 125 | }; |
diff --git a/include/linux/filter.h b/include/linux/filter.h index 5e3863d5f666..9ee8c67ea249 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h | |||
| @@ -308,9 +308,11 @@ struct bpf_binary_header { | |||
| 308 | struct bpf_prog { | 308 | struct bpf_prog { |
| 309 | u16 pages; /* Number of allocated pages */ | 309 | u16 pages; /* Number of allocated pages */ |
| 310 | bool jited; /* Is our filter JIT'ed? */ | 310 | bool jited; /* Is our filter JIT'ed? */ |
| 311 | bool gpl_compatible; /* Is our filter GPL compatible? */ | ||
| 311 | u32 len; /* Number of filter blocks */ | 312 | u32 len; /* Number of filter blocks */ |
| 312 | struct sock_fprog_kern *orig_prog; /* Original BPF program */ | 313 | enum bpf_prog_type type; /* Type of BPF program */ |
| 313 | struct bpf_prog_aux *aux; /* Auxiliary fields */ | 314 | struct bpf_prog_aux *aux; /* Auxiliary fields */ |
| 315 | struct sock_fprog_kern *orig_prog; /* Original BPF program */ | ||
| 314 | unsigned int (*bpf_func)(const struct sk_buff *skb, | 316 | unsigned int (*bpf_func)(const struct sk_buff *skb, |
| 315 | const struct bpf_insn *filter); | 317 | const struct bpf_insn *filter); |
| 316 | /* Instructions for interpreter */ | 318 | /* Instructions for interpreter */ |
