From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933504AbeAIPmH (ORCPT + 1 other); Tue, 9 Jan 2018 10:42:07 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40207 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758710AbeAIPhY (ORCPT ); Tue, 9 Jan 2018 10:37:24 -0500 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , David Ahern , Andi Kleen , Alexander Shishkin , Peter Zijlstra Subject: [PATCH 36/49] perf tools: Add cpu into struct perf_mmap Date: Tue, 9 Jan 2018 16:35:09 +0100 Message-Id: <20180109153522.14116-37-jolsa@kernel.org> In-Reply-To: <20180109153522.14116-1-jolsa@kernel.org> References: <20180109153522.14116-1-jolsa@kernel.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 09 Jan 2018 15:37:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: It will be useful in following patch to pin thread to cpu based on the map it processes. Link: http://lkml.kernel.org/n/tip-wmuc4l9cmfiyfkrjon4sungb@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/util/evlist.c | 2 +- tools/perf/util/mmap.c | 3 ++- tools/perf/util/mmap.h | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index 93bf777ef7c7..d1127c9027e5 100644 --- a/tools/perf/util/evlist.c +++ b/tools/perf/util/evlist.c @@ -888,7 +888,7 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx, if (*output == -1) { *output = fd; - if (perf_mmap__mmap(&maps[idx], mp, *output) < 0) + if (perf_mmap__mmap(&maps[idx], mp, *output, cpu) < 0) return -1; } else { if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, *output) != 0) diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c index 3f3b5a574484..da587e7d7eed 100644 --- a/tools/perf/util/mmap.c +++ b/tools/perf/util/mmap.c @@ -199,7 +199,7 @@ void perf_mmap__munmap(struct perf_mmap *map) auxtrace_mmap__munmap(&map->auxtrace_mmap); } -int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd) +int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd, int cpu) { /* * The last one will be done at perf_evlist__mmap_consume(), so that we @@ -226,6 +226,7 @@ int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd) return -1; } map->fd = fd; + map->cpu = cpu; if (auxtrace_mmap__mmap(&map->auxtrace_mmap, &mp->auxtrace_mp, map->base, fd)) diff --git a/tools/perf/util/mmap.h b/tools/perf/util/mmap.h index 5cec43f6f1e8..b14bf0040518 100644 --- a/tools/perf/util/mmap.h +++ b/tools/perf/util/mmap.h @@ -18,6 +18,7 @@ struct perf_mmap { void *base; int mask; int fd; + int cpu; refcount_t refcnt; u64 prev; struct auxtrace_mmap auxtrace_mmap; @@ -59,7 +60,7 @@ struct mmap_params { bool track_mmap; }; -int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd); +int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd, int cpu); void perf_mmap__munmap(struct perf_mmap *map); void perf_mmap__get(struct perf_mmap *map); -- 2.13.6