Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4258075ybp; Mon, 7 Oct 2019 05:54:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqyHZMFYe+q1skOxWFIDfg3yzIlnuBULtJXy6rufftQVZswwKA3kU6xD1QzWJWsOQ5XTjaaL X-Received: by 2002:a17:906:13cd:: with SMTP id g13mr23697143ejc.302.1570452878937; Mon, 07 Oct 2019 05:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570452878; cv=none; d=google.com; s=arc-20160816; b=GgqwgAri0JiHPyGijPmTgrdOlOuRWo9KOe553yLo6bliDqPxXsCKz7VaulRvcHbY/t LD4el9HQdhfp5WAJqEEXZUyy3GsMROXLMQefoVSe9uyesJ5dpg65Qq1WPK6LV5VdT/QS cp+LH1RGHEDr3z/u/DblJ9eM+3WNBSPA8gzzyA8Y4zCAEfHif8QEz+Z/RS9yzyUcHnT0 2i+mNKBL73tHM0tMJoenVeSESP4P2CnjSUfJk6AF3Ac6eS2NaS4HajNTVxEHzOOjIBK0 GCYo7lUPRChc9PwjP14YZgg6Vt38sXRVokvZR8t8CUYjhvVVc+ZRpM6/j+ssCFqbBmIz X9mg== 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=X4eSkFo8TKZ+Ja+V8P/Zsej2D/NLdcSF9LuqHOn5OyE=; b=CbjvcU1vNr7dBHrcGQHR5gztmJt9GfA7fV2rql9rp40fxp2q7bGWpNlwtHTOYX/+QC RkmJbNoOk7nDXKBk42eA7j6o7FhqItZ+0N87xpIf9iQ9hhrhtzINFkilL+tvmIn9zj+b aSJFFhvAH6/KTZBD4n8dj8Tm+D+OgenAubiDH8rHXOaAIyo04jLAfF8BknMgzfWdge69 NZ7ENwLM4wpRZNiyd0ocH+lcwU67G48cCiB/+DKYtsg12uWNiD7Z84ssnaScBXNPlX5A jpxJIz9P9r+HZey5z3yTrsXsx980NQ6TQDJF2HVwSbqMX32gZ0Xyh/OQyvnAQtRbALMM RhgQ== 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 f30si9099491ede.435.2019.10.07.05.54.15; Mon, 07 Oct 2019 05:54:38 -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 S1728056AbfJGMyA (ORCPT + 99 others); Mon, 7 Oct 2019 08:54:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:65504 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727490AbfJGMx6 (ORCPT ); Mon, 7 Oct 2019 08:53:58 -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 EB6303C918; Mon, 7 Oct 2019 12:53:57 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 547105D9CC; Mon, 7 Oct 2019 12:53:56 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Alexander Shishkin , Michael Petlan , Namhyung Kim , Peter Zijlstra , lkml , Ingo Molnar Subject: [PATCH 05/36] libperf: Add perf_mmap__get() function Date: Mon, 7 Oct 2019 14:53:13 +0200 Message-Id: <20191007125344.14268-6-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.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 07 Oct 2019 12:53:58 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move perf_mmap__get() from tools/perf to libperf in the internal header internal/mmap.h. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lore.kernel.org/lkml/20190913132355.21634-44-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-record.c | 2 +- tools/perf/lib/include/internal/mmap.h | 1 + tools/perf/lib/mmap.c | 5 +++++ tools/perf/util/evlist.c | 2 +- tools/perf/util/mmap.c | 5 ----- tools/perf/util/mmap.h | 1 - 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index f05e8b7955e4..025a12b57325 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -293,7 +293,7 @@ static int record__aio_pushfn(struct mmap *map, void *to, void *buf, size_t size * after started aio request completion or at record__aio_push() * if the request failed to start. */ - perf_mmap__get(map); + perf_mmap__get(&map->core); } aio->size += size; diff --git a/tools/perf/lib/include/internal/mmap.h b/tools/perf/lib/include/internal/mmap.h index 7067b70c6f61..2e68974bffb4 100644 --- a/tools/perf/lib/include/internal/mmap.h +++ b/tools/perf/lib/include/internal/mmap.h @@ -39,5 +39,6 @@ size_t perf_mmap__mmap_len(struct perf_mmap *map); void perf_mmap__init(struct perf_mmap *map, bool overwrite); int perf_mmap__mmap(struct perf_mmap *map, struct perf_mmap_param *mp, int fd, int cpu); +void perf_mmap__get(struct perf_mmap *map); #endif /* __LIBPERF_INTERNAL_MMAP_H */ diff --git a/tools/perf/lib/mmap.c b/tools/perf/lib/mmap.c index b216a7db857f..b765e0505bb6 100644 --- a/tools/perf/lib/mmap.c +++ b/tools/perf/lib/mmap.c @@ -31,3 +31,8 @@ int perf_mmap__mmap(struct perf_mmap *map, struct perf_mmap_param *mp, map->cpu = cpu; return 0; } + +void perf_mmap__get(struct perf_mmap *map) +{ + refcount_inc(&map->refcnt); +} diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 055f625dc630..a7ba22e18e7b 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -677,7 +677,7 @@ static int evlist__mmap_per_evsel(struct evlist *evlist, int idx, if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, *output) != 0) return -1; - perf_mmap__get(&maps[idx]); + perf_mmap__get(&maps[idx].core); } revent = perf_evlist__should_poll(evlist, evsel) ? POLLIN : 0; diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index acef6e3f6b80..be691b58d8ab 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -110,11 +110,6 @@ static bool perf_mmap__empty(struct mmap *map) return perf_mmap__read_head(map) == map->core.prev && !map->auxtrace_mmap.base; } -void perf_mmap__get(struct mmap *map) -{ - refcount_inc(&map->core.refcnt); -} - void perf_mmap__put(struct mmap *map) { BUG_ON(map->core.base && refcount_read(&map->core.refcnt) == 0); diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h index a60e6ead7255..a73402ee8fe0 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -45,7 +45,6 @@ struct mmap_params { int mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu); void perf_mmap__munmap(struct mmap *map); -void perf_mmap__get(struct mmap *map); void perf_mmap__put(struct mmap *map); void perf_mmap__consume(struct mmap *map); -- 2.21.0