Re: [PATCH 5/9] perf, bpf: save bpf_prog_info in a rbtree in perf_env

From: Jiri Olsa
Date: Thu Feb 14 2019 - 07:26:44 EST


On Fri, Feb 08, 2019 at 05:17:01PM -0800, Song Liu wrote:

SNIP

> diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h
> index d01b8355f4ca..5894a177b7cf 100644
> --- a/tools/perf/util/env.h
> +++ b/tools/perf/util/env.h
> @@ -3,7 +3,10 @@
> #define __PERF_ENV_H
>
> #include <linux/types.h>
> +#include <linux/rbtree.h>
> #include "cpumap.h"
> +#include "rwsem.h"
> +#include "bpf-event.h"
>
> struct cpu_topology_map {
> int socket_id;
> @@ -64,6 +67,8 @@ struct perf_env {
> struct memory_node *memory_nodes;
> unsigned long long memory_bsize;
> u64 clockid_res_ns;
> + struct rw_semaphore bpf_info_lock;

why's the lock needed?

jirka