[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200302143154.258569-9-jolsa@kernel.org>
Date: Mon, 2 Mar 2020 15:31:47 +0100
From: Jiri Olsa <jolsa@...nel.org>
To: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>
Cc: Song Liu <songliubraving@...com>, netdev@...r.kernel.org,
bpf@...r.kernel.org, Andrii Nakryiko <andriin@...com>,
Yonghong Song <yhs@...com>, Martin KaFai Lau <kafai@...com>,
Jakub Kicinski <kuba@...nel.org>,
David Miller <davem@...hat.com>,
Björn Töpel <bjorn.topel@...el.com>,
John Fastabend <john.fastabend@...il.com>,
Jesper Dangaard Brouer <hawk@...nel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Song Liu <song@...nel.org>
Subject: [PATCH 08/15] bpf: Separate kallsyms add/del functions
Moving bpf_prog_ksym_node_add/del to __bpf_ksym_add/del
and changing the argument to 'struct bpf_ksym' object.
Acked-by: Song Liu <songliubraving@...com>
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
kernel/bpf/core.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index cd7049441953..387e1bac3a45 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -645,20 +645,20 @@ static LIST_HEAD(bpf_kallsyms);
static struct latch_tree_root bpf_ksym_tree __cacheline_aligned;
static struct latch_tree_root bpf_tree __cacheline_aligned;
-static void bpf_prog_ksym_node_add(struct bpf_prog_aux *aux)
+static void __bpf_ksym_add(struct bpf_ksym *ksym)
{
- WARN_ON_ONCE(!list_empty(&aux->ksym.lnode));
- list_add_tail_rcu(&aux->ksym.lnode, &bpf_kallsyms);
- latch_tree_insert(&aux->ksym.tnode, &bpf_ksym_tree, &bpf_ksym_tree_ops);
+ WARN_ON_ONCE(!list_empty(&ksym->lnode));
+ list_add_tail_rcu(&ksym->lnode, &bpf_kallsyms);
+ latch_tree_insert(&ksym->tnode, &bpf_ksym_tree, &bpf_ksym_tree_ops);
}
-static void bpf_prog_ksym_node_del(struct bpf_prog_aux *aux)
+static void __bpf_ksym_del(struct bpf_ksym *ksym)
{
- if (list_empty(&aux->ksym.lnode))
+ if (list_empty(&ksym->lnode))
return;
- latch_tree_erase(&aux->ksym.tnode, &bpf_ksym_tree, &bpf_ksym_tree_ops);
- list_del_rcu(&aux->ksym.lnode);
+ latch_tree_erase(&ksym->tnode, &bpf_ksym_tree, &bpf_ksym_tree_ops);
+ list_del_rcu(&ksym->lnode);
}
static bool bpf_prog_kallsyms_candidate(const struct bpf_prog *fp)
@@ -683,7 +683,7 @@ void bpf_prog_kallsyms_add(struct bpf_prog *fp)
spin_lock_bh(&bpf_lock);
latch_tree_insert(&fp->aux->ksym_tnode, &bpf_tree, &bpf_tree_ops);
- bpf_prog_ksym_node_add(fp->aux);
+ __bpf_ksym_add(&fp->aux->ksym);
spin_unlock_bh(&bpf_lock);
}
@@ -694,7 +694,7 @@ void bpf_prog_kallsyms_del(struct bpf_prog *fp)
spin_lock_bh(&bpf_lock);
latch_tree_erase(&fp->aux->ksym_tnode, &bpf_tree, &bpf_tree_ops);
- bpf_prog_ksym_node_del(fp->aux);
+ __bpf_ksym_del(&fp->aux->ksym);
spin_unlock_bh(&bpf_lock);
}
--
2.24.1
Powered by blists - more mailing lists