lkml.org 
[lkml]   [2019]   [Apr]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 11/12] perf tools: Reuse shared eBPF dso objects
From
Date
On 16/04/19 7:01 PM, Jiri Olsa wrote:
> The eBPF program can be loaded multiple times
> with the same name (tag). We can share dso
> objects for those programs.

Doesn't a eBPF program get recompiled differently every time it is loaded?

>
> Link: http://lkml.kernel.org/n/tip-3damf8vq1dryhtpbk5b06jpt@git.kernel.org
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
> tools/perf/util/machine.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index d4aa44489011..a60653827891 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -23,6 +23,7 @@
> #include "linux/hash.h"
> #include "asm/bug.h"
> #include "bpf-event.h"
> +#include "dso.h"
>
> #include "sane_ctype.h"
> #include <symbol/kallsyms.h>
> @@ -699,11 +700,18 @@ static int machine__process_ksymbol_register(struct machine *machine,
>
> map = map_groups__find(&machine->kmaps, event->ksymbol_event.addr);
> if (!map) {
> - map = dso__new_map(event->ksymbol_event.name);
> - if (!map)
> + struct dso *dso;
> +
> + dso = dsos__findnew(&machine->dsos, event->ksymbol_event.name);
> + if (!dso)
> return -ENOMEM;
>
> - map->start = event->ksymbol_event.addr;
> + map = map__new2(event->ksymbol_event.addr, dso);
> + if (!map) {
> + dso__put(dso);
> + return -ENOMEM;
> + }
> +
> map->end = map->start + event->ksymbol_event.len;
> map_groups__insert(&machine->kmaps, map);
> }
>

\
 
 \ /
  Last update: 2019-04-17 08:37    [W:0.154 / U:25.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site