Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp913083ybe; Fri, 13 Sep 2019 08:14:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqyv+kkWMxGvBXVH8rA0QgAmaiOXBfcomvgne6dzUwLpLsx+u3i4jD9Lwixx+6gCqh4bRFd7 X-Received: by 2002:a50:f41a:: with SMTP id r26mr26091406edm.300.1568387657827; Fri, 13 Sep 2019 08:14:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568387657; cv=none; d=google.com; s=arc-20160816; b=HRBbrjZ+z6kZ+/NNjG+Ejc22VwA/luPt8XY0NxgzZGQrnVt4wgGP5ZEbWf8XhwkWaC HKxU0mW1JxzOWHk7jK7uwXh+Y88k/Qk08zfJncc4XQmivV1hAhFm7qrwAsV7WJQ2byXV D08R6rktIBw5P8tWfkpMquwQe7NHtxQd2uUJKjwwdIt3068ximT/TABYlCheoaeYbkVP 35MQfJUGiE1QwGyJXShmbsG81jw+Ne6FlvYxEfeBc2eTJXKAmoiJnWkU25pezOd3NqhJ CNmGChlMYa7ZV2OMm+pzxWSZwQ9JPl3bBPwN1QlShnc0dUVcmpvwwKdJvHsaNpLQ0KZR 1YLA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nZly/dujg7cNyVh3dYrgd5Rw55RDA3akwJctKBzuo4g=; b=HnrBkmdDzrxKc23shCjtzbB9f2faoNc2WCnusi3pCuXEvUaC14lquihoLcq7b8WdZw o1fLtIUyNoCnYL8x2lvIlTQqWbWBu/eXLkMAT88LUHPJasWjSdiUQ+/veKHbJtOFQ4IJ XYR6kNK8jzAshVBmxSnetXHiiVGwE20odeIL6Vd5ASxjl+kX0DgiaxVLitRparyXlzCM kqMHyrhF1q+bSm469sS0o0C0rJ7AbTUtHJkJeOj4KuMb7fwyzbOkyPhEQntJky8b7Hw0 oirSGv0YD3/jMc5TvWdwoDzyC9K/vaftyXJRDwP9Ynk3MDztXttjye/Jfe1/esB5uWwJ mxJw== 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 b27si14460315eje.123.2019.09.13.08.13.54; Fri, 13 Sep 2019 08:14:17 -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 S2390721AbfIMN0a (ORCPT + 99 others); Fri, 13 Sep 2019 09:26:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57284 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403805AbfIMN01 (ORCPT ); Fri, 13 Sep 2019 09:26:27 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A76A30860C0; Fri, 13 Sep 2019 13:26:27 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3AC55C1D4; Fri, 13 Sep 2019 13:26:25 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 61/73] libperf: Move pollfd allocation to libperf Date: Fri, 13 Sep 2019 15:23:43 +0200 Message-Id: <20190913132355.21634-62-jolsa@kernel.org> In-Reply-To: <20190913132355.21634-1-jolsa@kernel.org> References: <20190913132355.21634-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 13 Sep 2019 13:26:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's needed in libperf only, moving it to perf_evlist__mmap_ops function. Link: http://lkml.kernel.org/n/tip-7lmjzpk6k2wfhh1os8qw1dxz@git.kernel.org Signed-off-by: Jiri Olsa --- 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 ec83022cd62f..e27fe1fcef3d 100644 --- a/tools/perf/lib/evlist.c +++ b/tools/perf/lib/evlist.c @@ -32,6 +32,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, @@ -110,6 +111,7 @@ void perf_evlist__delete(struct perf_evlist *evlist) { free(evlist->mmap); free(evlist->mmap_ovw); + fdarray__exit(&evlist->pollfd); free(evlist); } @@ -489,6 +491,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 94d8a1d96b81..728a15cddda7 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -57,7 +57,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; } @@ -804,9 +803,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; -- 2.21.0