Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3322991yba; Tue, 16 Apr 2019 09:03:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxd8o6m+TFNv1dWnM0BBlTjNhyTtFlQVOnBFNKnTBC9tXng+dLFMTJU97u4eFV+DeeenKY6 X-Received: by 2002:aa7:83ce:: with SMTP id j14mr54685094pfn.57.1555430605578; Tue, 16 Apr 2019 09:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555430605; cv=none; d=google.com; s=arc-20160816; b=ahx7U9KdeECg224srdoHOQOjMexIE5EX6ZH/HDw9N9cQ3i9vefHceB78v2MrM+0fta mi6PjynWdOrYrModeyerjcJjh3rJMeEO0An3vT5ff74uUTtlZXWkKjPPyqsjMSYoqXoB Ja2eUQeN6cTBooL5rvhs9RrpJ8SA0Od5NpmUnZh7xoj4s2X7oFMAIYMC6Y4avgVhSDbK EIvTBzOMIei5x2+84+XgEfHwDfKCSPwRyRJNGrUCqLD5pORdYv3WPwNdvKU245n8SKtz CWCmPRfR4UdVi+RUeY11lSm9zeFnyXzivsr5ElItVYiWFUC/DSPUopT+xdratE/XCYjW vIMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=5M5BcZP6ADHjTu+IGJKw/KO5mFddr/sfdT2oHWpnYmA=; b=g/EWOND3nFWOe1joCUptwKC6eHp7BQ6pSLPpxo6+SoluPmVnBc5rYhSONnAAmlHane zeYV4EPcuDhUox1LsZDqtR7qkJLvZH7Fn6639uL/7DoTRzftvUQmW8LchVyMXukwxP+S XSYTKZvse9lj4T1QQynd9PRgbmdMxtyWa+kGicPp0NvWP1cwmH6NrkeDgBxlHyJIuC8K 7jLN7RVmKbIa0e/6iLAQWXsoCPVGowE1vMVUaG6dX0eaIH1entOf10aF39CGnrvSBWS+ eI+Hf3GkZbC8kAiDN0/zuI1IrSqHL1Gvh5Vx8pj5AYgPNdt+Vkgx1h6RDFZcbpjwzt2t 8G/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si37577126pgm.258.2019.04.16.09.03.09; Tue, 16 Apr 2019 09:03:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730073AbfDPQCK (ORCPT + 99 others); Tue, 16 Apr 2019 12:02:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32956 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbfDPQCI (ORCPT ); Tue, 16 Apr 2019 12:02:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 67843C04FFF9; Tue, 16 Apr 2019 16:02:08 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 195295D71E; Tue, 16 Apr 2019 16:02:05 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Andi Kleen , Adrian Hunter , Song Liu , Alexei Starovoitov , Daniel Borkmann Subject: [PATCH 11/12] perf tools: Reuse shared eBPF dso objects Date: Tue, 16 Apr 2019 18:01:26 +0200 Message-Id: <20190416160127.30203-12-jolsa@kernel.org> In-Reply-To: <20190416160127.30203-1-jolsa@kernel.org> References: <20190416160127.30203-1-jolsa@kernel.org> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 16 Apr 2019 16:02:08 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The eBPF program can be loaded multiple times with the same name (tag). We can share dso objects for those programs. Link: http://lkml.kernel.org/n/tip-3damf8vq1dryhtpbk5b06jpt@git.kernel.org Signed-off-by: Jiri Olsa --- 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 @@ -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); } -- 2.17.2