Re: [PATCH v4 perf,bpf 06/15] perf, bpf: save bpf_prog_info in a rbtree in perf_env

From: Jiri Olsa
Date: Wed Feb 27 2019 - 08:21:37 EST


On Mon, Feb 25, 2019 at 04:20:10PM -0800, Song Liu wrote:

SNIP

> @@ -38,6 +116,12 @@ void perf_env__exit(struct perf_env *env)
> zfree(&env->memory_nodes);
> }
>
> +static void init_bpf_rb_trees(struct perf_env *env)
> +{
> + env->bpf_progs.prog_infos = RB_ROOT;
> + init_rwsem(&env->bpf_progs.lock);
> +}
> +
> int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[])
> {
> int i;
> @@ -59,6 +143,7 @@ int perf_env__set_cmdline(struct perf_env *env, int argc, const char *argv[])
>
> env->nr_cmdline = argc;
>
> + init_bpf_rb_trees(env);

this souldn't be in perf_env__set_cmdline,
it's there to set the cmdline

struct bpf_progs is first in perf_env that
needs other than zero initialization, so
I think we need to add perf_env__init function,
that will do that for all the paths that uses
perf_env


jirka