Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5492276ybp; Mon, 14 Oct 2019 23:52:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwlHjcmw4Na23VrTnVlUmvI5xwU0iatppXZM29CpjKyE0dYPrbRAwBDsV7qvgBqYWjkENtD X-Received: by 2002:a17:906:82cf:: with SMTP id a15mr32784224ejy.279.1571122363632; Mon, 14 Oct 2019 23:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571122363; cv=none; d=google.com; s=arc-20160816; b=o0F0XHLAyAUWA1pFpT/5fAYM6c4T+UubztWl64BpKqNwzURf1VAcHUm3C9mhQ5HVuO HKjUJzM8Sbqfp8s+g4s8jNfcvgfvRw110qw3tM7AwNYQGNSx8zN2QbDiVDXZ4snRwMz1 Cp2sBXLMLyr/VUlsfhK3jGFFVidfN1lvRRAPCmFAJOb+ddprXf9RlpVg16mkWKcIwaVp hFju7CCnOY/REQb6aRX2HYZjkVqDHiPa57noabCx7rj9aMdzTeRV/BhC05D0FdmzVIPu D6cAZEIcanHcFBVRxbHfa6xUAwf/tMPUbdsJNXCYlKjB59uEZtWWT6vMsRNIFrnUwi3a FcYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:date; bh=sfuMtNAa4ed9j14jBGplUGzjrjNzbuarrFbVYPgqjyw=; b=DaIvNfLsoaJ+z0/hCXzYtHMGEGcZVOguovDsILpu3dhnvi6Kzy7xIChzcv6k7ACBTf xD67FMCW4KnVN9dOHfPS8MS4tJ8EavDUBUrLJO87LcmsP8LrwP46Kf1kx77oe+tOGxdi esMAuSkXzX1H1k1GFKn/mYXWXgLSz0NmkvW0OxfrKaKVL9ls1790J2aftBrHhXrPPWa8 n63Bg+NkScwZ6zrhIvT+06zZgs/fn2jokuu7KmdQd/fzjMSsJYj28YCEBte40x24EyAX 3gr1m6T31hHBH5LvxuU/e9UUW3KcyTfsG0IeYg+zD2H24uI8vulD9+uU0Hzt+3a+ZhBL 34gw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o32si14084282edc.306.2019.10.14.23.52.20; Mon, 14 Oct 2019 23:52:43 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726136AbfJOFiG (ORCPT + 99 others); Tue, 15 Oct 2019 01:38:06 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:41961 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728173AbfJOFb4 (ORCPT ); Tue, 15 Oct 2019 01:31:56 -0400 Received: from [5.158.153.53] (helo=tip-bot2.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iKFQm-0008S8-9V; Tue, 15 Oct 2019 07:31:36 +0200 Received: from [127.0.1.1] (localhost [IPv6:::1]) by tip-bot2.lab.linutronix.de (Postfix) with ESMTP id EEB331C0105; Tue, 15 Oct 2019 07:31:35 +0200 (CEST) Date: Tue, 15 Oct 2019 05:31:35 -0000 From: "tip-bot2 for Jiri Olsa" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] libperf: Introduce perf_evlist__exit() Cc: Jiri Olsa , Alexander Shishkin , Michael Petlan , Namhyung Kim , Peter Zijlstra , Arnaldo Carvalho de Melo , Ingo Molnar , Borislav Petkov , linux-kernel@vger.kernel.org In-Reply-To: <20191007125344.14268-25-jolsa@kernel.org> References: <20191007125344.14268-25-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <157111749587.12254.16297376340208825345.tip-bot2@tip-bot2> X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: 93dd6e2831ff399f7685aa2157b997b6392efac8 Gitweb: https://git.kernel.org/tip/93dd6e2831ff399f7685aa2157b997b6392efac8 Author: Jiri Olsa AuthorDate: Mon, 07 Oct 2019 14:53:32 +02:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Thu, 10 Oct 2019 12:56:01 -03:00 libperf: Introduce perf_evlist__exit() Add the perf_evlist__exit() function, so far it's not exported and added only for internal use for perf and libperf. USe it to release cpus/threads and pollfd array. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20191007125344.14268-25-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/lib/evlist.c | 12 +++++++++++- tools/perf/lib/include/internal/evlist.h | 2 ++ tools/perf/util/evlist.c | 6 +----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c index 5ae1da9..7ba98f0 100644 --- a/tools/perf/lib/evlist.c +++ b/tools/perf/lib/evlist.c @@ -109,13 +109,23 @@ perf_evlist__next(struct perf_evlist *evlist, struct perf_evsel *prev) return next; } +void perf_evlist__exit(struct perf_evlist *evlist) +{ + perf_cpu_map__put(evlist->cpus); + perf_thread_map__put(evlist->threads); + evlist->cpus = NULL; + evlist->threads = NULL; + fdarray__exit(&evlist->pollfd); +} + void perf_evlist__delete(struct perf_evlist *evlist) { if (evlist == NULL) return; perf_evlist__munmap(evlist); - fdarray__exit(&evlist->pollfd); + perf_evlist__close(evlist); + perf_evlist__exit(evlist); free(evlist); } diff --git a/tools/perf/lib/include/internal/evlist.h b/tools/perf/lib/include/internal/evlist.h index b201970..0721512 100644 --- a/tools/perf/lib/include/internal/evlist.h +++ b/tools/perf/lib/include/internal/evlist.h @@ -48,6 +48,8 @@ int perf_evlist__mmap_ops(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops, struct perf_mmap_param *mp); +void perf_evlist__exit(struct perf_evlist *evlist); + /** * __perf_evlist__for_each_entry - iterate thru all the evsels * @list: list_head instance to iterate diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 5192c65..031ace3 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -138,7 +138,7 @@ void evlist__exit(struct evlist *evlist) { zfree(&evlist->mmap); zfree(&evlist->overwrite_mmap); - fdarray__exit(&evlist->core.pollfd); + perf_evlist__exit(&evlist->core); } void evlist__delete(struct evlist *evlist) @@ -148,10 +148,6 @@ void evlist__delete(struct evlist *evlist) evlist__munmap(evlist); evlist__close(evlist); - perf_cpu_map__put(evlist->core.cpus); - perf_thread_map__put(evlist->core.threads); - evlist->core.cpus = NULL; - evlist->core.threads = NULL; evlist__purge(evlist); evlist__exit(evlist); free(evlist);