Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5449358ybp; Mon, 14 Oct 2019 22:59:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRAEreGlOqk6h0Jr0ubk1PE9Y3Obz0FwU3+b0KSX/T6Ut0esRiLQ5125FHQywwatDbPzxo X-Received: by 2002:a17:906:1e07:: with SMTP id g7mr33125300ejj.256.1571119189411; Mon, 14 Oct 2019 22:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571119189; cv=none; d=google.com; s=arc-20160816; b=yAqJtaQ+f/Zy5irZ9x27FkiGsOC2A91sGI+WXKUxQo8lFAg9WQfyF6XfeqfAxpy+K2 X+MGYFROGS+j5rPqHyC4q8fm8D0cTxRJHE+GS7R3QQB9kave1/YSo3jAN66vilvaNIjS 6ECE/VQLeyF6BUWBSpCbhHIA+sX3HRZLwIBR2tfEllwYUxlRZN9HGmZelwoVHQhbKE2J imLU+ZWQX0XuMRi402sahU+1LjAbvGTxNzKi19s5k/IUk+M4HF0rsY8FTPtvVRfRe1GG CjeRmacyfQDYcgOY4Hhnu47ntDaTSMbFs0JPbIlbPrkdHx4+e668opVId/gK/CHO+XQK gYlQ== 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=gHF2XwiuDGo+MGgECfKTUW0DFmWp6L5JFbg0sfl9CvQ=; b=uObmU4w3in/4Z0vH1ch22itZ16zyjuc1edM/rK2XaIBTuJxqoavEXEeQesD/WcjrbM OABIjdyTIaRZB6w2CSjekwdbzPJgdzBDQzkEGPU6M4Iy+I8W/ibtlYSrATo/GjyN3lf9 T5KsjDuE17Hv2vV0MyIKzIi1Nn39R3z6yjlOEt7upYhp0AUWXsOVZ+DiGCt4JDaEXuGg pgeIdbJD7NIHJGLbPgXt11FZr9wJUGjMGkgI/HV346j2KCutR9lo3/Ta+Z6XJICxknlY LbIAf3Bn9DSn0rRkpeidRc9KM1O9P7Dxpx5tOYLdUfXq8+Ymd/7+jL36qyBp3ENTwXcv i9Cw== 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 y71si13431301ede.135.2019.10.14.22.59.25; Mon, 14 Oct 2019 22:59:49 -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 S1729073AbfJOFd7 (ORCPT + 99 others); Tue, 15 Oct 2019 01:33:59 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:42206 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728627AbfJOFcQ (ORCPT ); Tue, 15 Oct 2019 01:32:16 -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-0008SC-HL; 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 3B9D51C03AB; Tue, 15 Oct 2019 07:31:36 +0200 (CEST) Date: Tue, 15 Oct 2019 05:31:36 -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: Move the pollfd allocation from tools/perf to libperf 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-24-jolsa@kernel.org> References: <20191007125344.14268-24-jolsa@kernel.org> MIME-Version: 1.0 Message-ID: <157111749616.12254.13205504186119776560.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: 230662e15ed6cc63ecf72ed1bffa3cadef486850 Gitweb: https://git.kernel.org/tip/230662e15ed6cc63ecf72ed1bffa3cadef486850 Author: Jiri Olsa AuthorDate: Mon, 07 Oct 2019 14:53:31 +02:00 Committer: Arnaldo Carvalho de Melo CommitterDate: Thu, 10 Oct 2019 12:54:35 -03:00 libperf: Move the pollfd allocation from tools/perf to libperf It's needed in libperf only, so move it to the perf_evlist__mmap_ops() function. 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-24-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/lib/evlist.c | 5 +++++ tools/perf/util/evlist.c | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/perf/lib/evlist.c b/tools/perf/lib/evlist.c index f9a802d..5ae1da9 100644 --- a/tools/perf/lib/evlist.c +++ b/tools/perf/lib/evlist.c @@ -34,6 +34,7 @@ void perf_evlist__init(struct perf_evlist *evlist) INIT_HLIST_HEAD(&evlist->heads[i]); INIT_LIST_HEAD(&evlist->entries); evlist->nr_entries = 0; + fdarray__init(&evlist->pollfd, 64); } static void __perf_evlist__propagate_maps(struct perf_evlist *evlist, @@ -114,6 +115,7 @@ void perf_evlist__delete(struct perf_evlist *evlist) return; perf_evlist__munmap(evlist); + fdarray__exit(&evlist->pollfd); free(evlist); } @@ -525,6 +527,9 @@ int perf_evlist__mmap_ops(struct perf_evlist *evlist, return -ENOMEM; } + if (evlist->pollfd.entries == NULL && perf_evlist__alloc_pollfd(evlist) < 0) + return -ENOMEM; + if (perf_cpu_map__empty(cpus)) return mmap_per_thread(evlist, ops, mp); diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 3f4f11f..5192c65 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -58,7 +58,6 @@ void evlist__init(struct evlist *evlist, struct perf_cpu_map *cpus, { perf_evlist__init(&evlist->core); perf_evlist__set_maps(&evlist->core, cpus, threads); - fdarray__init(&evlist->core.pollfd, 64); evlist->workload.pid = -1; evlist->bkw_mmap_state = BKW_MMAP_NOTREADY; } @@ -829,9 +828,6 @@ int evlist__mmap_ex(struct evlist *evlist, unsigned int pages, if (!evlist->mmap) return -ENOMEM; - if (evlist->core.pollfd.entries == NULL && perf_evlist__alloc_pollfd(&evlist->core) < 0) - return -ENOMEM; - evlist->core.mmap_len = evlist__mmap_size(pages); pr_debug("mmap size %zuB\n", evlist->core.mmap_len); mp.core.mask = evlist->core.mmap_len - page_size - 1;