aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/dispatcher.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@kernel.org>2020-03-12 20:56:07 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-03-13 12:49:52 -0700
commit7ac88eba185b4d0e06a71678e54bc092edcd3af3 (patch)
treeb693861f42cde02243deb69d151fa80fcee09364 /kernel/bpf/dispatcher.c
parentbpf: Add dispatchers to kallsyms (diff)
downloadlinux-dev-7ac88eba185b4d0e06a71678e54bc092edcd3af3.tar.xz
linux-dev-7ac88eba185b4d0e06a71678e54bc092edcd3af3.zip
bpf: Remove bpf_image tree
Now that we have all the objects (bpf_prog, bpf_trampoline, bpf_dispatcher) linked in bpf_tree, there's no need to have separate bpf_image tree for images. Reverting the bpf_image tree together with struct bpf_image, because it's no longer needed. Also removing bpf_image_alloc function and adding the original bpf_jit_alloc_exec_page interface instead. The kernel_text_address function can now rely only on is_bpf_text_address, because it checks the bpf_tree that contains all the objects. Keeping bpf_image_ksym_add and bpf_image_ksym_del because they are useful wrappers with perf's ksymbol interface calls. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200312195610.346362-13-jolsa@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/bpf/dispatcher.c')
-rw-r--r--kernel/bpf/dispatcher.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/bpf/dispatcher.c b/kernel/bpf/dispatcher.c
index a2679bae9e73..2444bd15cc2d 100644
--- a/kernel/bpf/dispatcher.c
+++ b/kernel/bpf/dispatcher.c
@@ -113,7 +113,7 @@ static void bpf_dispatcher_update(struct bpf_dispatcher *d, int prev_num_progs)
noff = 0;
} else {
old = d->image + d->image_off;
- noff = d->image_off ^ (BPF_IMAGE_SIZE / 2);
+ noff = d->image_off ^ (PAGE_SIZE / 2);
}
new = d->num_progs ? d->image + noff : NULL;
@@ -140,7 +140,7 @@ void bpf_dispatcher_change_prog(struct bpf_dispatcher *d, struct bpf_prog *from,
mutex_lock(&d->mutex);
if (!d->image) {
- d->image = bpf_image_alloc();
+ d->image = bpf_jit_alloc_exec_page();
if (!d->image)
goto out;
bpf_image_ksym_add(d->image, &d->ksym);