Commit 56a94706 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

libperf: Add 'cpu' to struct perf_mmap

Move 'cpu' from tools/perf's mmap to libperf's perf_mmap struct.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lore.kernel.org/lkml/20190913132355.21634-14-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 2cf07b29
...@@ -11,6 +11,7 @@ struct perf_mmap { ...@@ -11,6 +11,7 @@ struct perf_mmap {
void *base; void *base;
int mask; int mask;
int fd; int fd;
int cpu;
}; };
#endif /* __LIBPERF_INTERNAL_MMAP_H */ #endif /* __LIBPERF_INTERNAL_MMAP_H */
...@@ -256,7 +256,7 @@ static int perf_mmap__aio_mmap(struct mmap *map, struct mmap_params *mp) ...@@ -256,7 +256,7 @@ static int perf_mmap__aio_mmap(struct mmap *map, struct mmap_params *mp)
pr_debug2("failed to allocate data buffer area, error %m"); pr_debug2("failed to allocate data buffer area, error %m");
return -1; return -1;
} }
ret = perf_mmap__aio_bind(map, i, map->cpu, mp->affinity); ret = perf_mmap__aio_bind(map, i, map->core.cpu, mp->affinity);
if (ret == -1) if (ret == -1)
return -1; return -1;
/* /*
...@@ -347,9 +347,9 @@ static void perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params ...@@ -347,9 +347,9 @@ static void perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params
{ {
CPU_ZERO(&map->affinity_mask); CPU_ZERO(&map->affinity_mask);
if (mp->affinity == PERF_AFFINITY_NODE && cpu__max_node() > 1) if (mp->affinity == PERF_AFFINITY_NODE && cpu__max_node() > 1)
build_node_mask(cpu__get_node(map->cpu), &map->affinity_mask); build_node_mask(cpu__get_node(map->core.cpu), &map->affinity_mask);
else if (mp->affinity == PERF_AFFINITY_CPU) else if (mp->affinity == PERF_AFFINITY_CPU)
CPU_SET(map->cpu, &map->affinity_mask); CPU_SET(map->core.cpu, &map->affinity_mask);
} }
int perf_mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu) int perf_mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu)
...@@ -379,7 +379,7 @@ int perf_mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu) ...@@ -379,7 +379,7 @@ int perf_mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu)
return -1; return -1;
} }
map->core.fd = fd; map->core.fd = fd;
map->cpu = cpu; map->core.cpu = cpu;
perf_mmap__setup_affinity_mask(map, mp); perf_mmap__setup_affinity_mask(map, mp);
......
...@@ -22,7 +22,6 @@ struct aiocb; ...@@ -22,7 +22,6 @@ struct aiocb;
*/ */
struct mmap { struct mmap {
struct perf_mmap core; struct perf_mmap core;
int cpu;
refcount_t refcnt; refcount_t refcnt;
u64 prev; u64 prev;
u64 start; u64 start;
......
...@@ -991,7 +991,7 @@ static struct mmap *get_md(struct evlist *evlist, int cpu) ...@@ -991,7 +991,7 @@ static struct mmap *get_md(struct evlist *evlist, int cpu)
for (i = 0; i < evlist->nr_mmaps; i++) { for (i = 0; i < evlist->nr_mmaps; i++) {
struct mmap *md = &evlist->mmap[i]; struct mmap *md = &evlist->mmap[i];
if (md->cpu == cpu) if (md->core.cpu == cpu)
return md; return md;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment