Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4259392ybp; Mon, 7 Oct 2019 05:55:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwIWyVztG7PLeU1phfRJqDuZuWNFGqtBtDyqHw0/yhAJ8Of4qQPBZmRql5h29CjOgTSh9nB X-Received: by 2002:a17:906:c310:: with SMTP id s16mr24291647ejz.178.1570452956750; Mon, 07 Oct 2019 05:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570452956; cv=none; d=google.com; s=arc-20160816; b=OzlKkLTTJ7zpVYywvyUQVe/GQTHWSCL4ClGUF5VGWkWSNoP9lu1UhsTCWyyiOsBtG8 ZuXqyyCv4yh+05X0aisGe6LaK25LwlUdHl7+cbX9UUtcFQi6ryoUOrL21Ot3G11BBcpl BVA/mz2QqnsYV8Jdq8mbMAwd7sHHwIiyTPTZmRycmQDn6A3Re7LToWgpOWGRTUwWAxmN eWXCHv0U16+H2DM/y6ctmMd0dlu+7LILq43yvME71+RG1L24erYe1+smLhXhoeMFPyA2 huOFJuGJSK8Ebw+SZsrJWvgNtL8SI9MK8LLrNBQD4xfeYY+IRSf0xSdcvEQPLCN6tNWZ +STQ== 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=ywKuyPBLj3VS8/Qv7km+K9oiiW6BL4GwhIJE7T9p8CM=; b=JS/fz1OvaILaozXslqr8pDJCU1nGCkLx2B2vuJ1ehPjo+/aqp/4geqQpkocDes3RVW t1GGjXTSnRQ3qPtTdOIYYGoalAKU31C40B2morzigrDjFeK4gjCU6KPBg1/XNfMCswkt kDhj74TEt+p+jT9BQKrw0u1CBaACMxy0t/Dck1MX21woba3+fGlFC+mEGsQRJ1Cl12G2 7wlf6AMnYSoAxWzH43FioWWcTuYUsljaFDc8rFXvc2WUaRSVCDfQhILgfABi77Ak0jyS Dv176AKCIUQpGaUlBNupmBqr6OY2Rm0RXQylNB6Am21r7rX2CI7gotNT8lySDEzT1Wap 8thQ== 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 z4si6728729eji.316.2019.10.07.05.55.33; Mon, 07 Oct 2019 05:55:56 -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 S1728389AbfJGMyo (ORCPT + 99 others); Mon, 7 Oct 2019 08:54:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60632 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728372AbfJGMyl (ORCPT ); Mon, 7 Oct 2019 08:54:41 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E3BE410DCC82; Mon, 7 Oct 2019 12:54:40 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95EA05D9CC; Mon, 7 Oct 2019 12:54:38 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 23/36] libperf: Move pollfd allocation to libperf Date: Mon, 7 Oct 2019 14:53:31 +0200 Message-Id: <20191007125344.14268-24-jolsa@kernel.org> In-Reply-To: <20191007125344.14268-1-jolsa@kernel.org> References: <20191007125344.14268-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Mon, 07 Oct 2019 12:54:41 +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 f9a802d2ceb5..5ae1da97d2e6 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 bbefb81a6364..71679cce7257 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; } @@ -805,9 +804,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