Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp795752ybe; Fri, 13 Sep 2019 06:31:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxQKpUwLxrq1aWtJ0XoGO3LwiywkYGaBUX4nl5GqhYcvedktP0/5BJadPaPe6+fMZmmpPJa X-Received: by 2002:aa7:db59:: with SMTP id n25mr48020737edt.77.1568381474925; Fri, 13 Sep 2019 06:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568381474; cv=none; d=google.com; s=arc-20160816; b=pBvbF/LBZRlZfH83wjoO+qlivMcVWhqjGS7IUt/eUXunExXlRyfSjXtOLPBL9qAxyR jMihLcg9rxriK9VSQqYBnd/yUAOyalb4GiYVc35Y4y0b7MowlOEPviBqQJyiri+YiCJe uLVB78i89Oaq1V1sPYbLeJQvy3FXmFW0BCil1U8I8trayFhEPKMm6jfYW8hxO8Odmx3H wWiNO3Pd/FeV52UC/2X+cBnUq4ZQeYbFNf1DielPnDb6jrd7mxNq76xwiK1DSwVuGA1k rqxi2OSVQEf8rYei7tJylFAFI6CrMZDGXwtq1V7w26MR1SGEoO8x3j5oYYfKvuzKUJD+ y6Lg== 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=ftMSsR1L2rSlf2tRRuVRslWdtvREAgBSqnfjaSiCG44=; b=f54eMQ++sj+hO8tJWbngm0oc2N6d9/JW+UxV3/QFOS1jH1axyXqtGi8+WUp/OxgXhw xyotLA6da/0P7GUYDzXV88W8tE7c+BbkN8ns2CTlzaAKzVFMm28svgV4NVwJwGzgcufh ivywfslIp3mTBEYppJ2PFOH9Mna+E8La0+TmQJhM/iJI6fl1nSjCAUqRcYOS7fJNqko3 HeHXosePOghN2ejECR1dQ7a9DCzP4DwMa7vJygRl8RkDp4Hvqg3zeOXDDX2DjhPw8AtP LWU49hPHhxQ3VoijW4yI8vCRn9NbiyxbAaaILExtKcJC2tA/NpaAeRzDQlmQ15F0V+Sp oVOw== 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 y10si9188727edc.48.2019.09.13.06.30.35; Fri, 13 Sep 2019 06:31:14 -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 S2391443AbfIMNZs (ORCPT + 99 others); Fri, 13 Sep 2019 09:25:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59516 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390591AbfIMNZp (ORCPT ); Fri, 13 Sep 2019 09:25:45 -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 0673118C4275; Fri, 13 Sep 2019 13:25:45 +0000 (UTC) Received: from krava.brq.redhat.com (unknown [10.43.17.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 62EEA5C1D4; Fri, 13 Sep 2019 13:25:43 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: [PATCH 43/73] libperf: Add perf_mmap__get function Date: Fri, 13 Sep 2019 15:23:25 +0200 Message-Id: <20190913132355.21634-44-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.6.2 (mx1.redhat.com [10.5.110.62]); Fri, 13 Sep 2019 13:25:45 +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 function under libperf to internal header internal/mmap.h. Link: http://lkml.kernel.org/n/tip-iq4yp3dsr2a4yzdkukholo8o@git.kernel.org Signed-off-by: Jiri Olsa --- 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 40780434b23e..82f6bd6b1adc 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -290,7 +290,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 5452ed7dabfe..372521cae06d 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 8da573307734..0191d3b2eb20 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -676,7 +676,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 7096e9b130cd..a7e0b4afc176 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -109,11 +109,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 aeb94d128354..f7ee0252db24 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -73,7 +73,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