libperf: Add 'cpu' to struct perf_mmap
authorJiri Olsa <jolsa@kernel.org>
Sat, 27 Jul 2019 20:33:20 +0000 (22:33 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 25 Sep 2019 12:51:45 +0000 (09:51 -0300)
Move 'cpu' from tools/perf's mmap to libperf's perf_mmap struct.

Signed-off-by: Jiri 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.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/lib/include/internal/mmap.h
tools/perf/util/mmap.c
tools/perf/util/mmap.h
tools/perf/util/python.c

index 892cbd401d8d718782b8ec53922169f67f520a2b..f7d1809fa34c82bdba6ceea2614b0b40142a01b5 100644 (file)
@@ -11,6 +11,7 @@ struct perf_mmap {
        void            *base;
        int              mask;
        int              fd;
+       int              cpu;
 };
 
 #endif /* __LIBPERF_INTERNAL_MMAP_H */
index 40bf124cb6581b00fdccce47007f705c09c1d9ef..dc83208913449000d485e1d4cd38e1b37a98343e 100644 (file)
@@ -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");
                                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)
                                return -1;
                        /*
@@ -347,9 +347,9 @@ static void perf_mmap__setup_affinity_mask(struct mmap *map, struct mmap_params
 {
        CPU_ZERO(&map->affinity_mask);
        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)
-               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)
@@ -379,7 +379,7 @@ int perf_mmap__mmap(struct mmap *map, struct mmap_params *mp, int fd, int cpu)
                return -1;
        }
        map->core.fd = fd;
-       map->cpu = cpu;
+       map->core.cpu = cpu;
 
        perf_mmap__setup_affinity_mask(map, mp);
 
index de991194af8db1f62f2f7f268f2827e1b0ea6f30..8ab779c98f4d38112dae5fefea3f3f871112e814 100644 (file)
@@ -22,7 +22,6 @@ struct aiocb;
  */
 struct mmap {
        struct perf_mmap        core;
-       int              cpu;
        refcount_t       refcnt;
        u64              prev;
        u64              start;
index 60a6b6e8e17641342bc7e64884ae3343e10a9211..ba4085d7ae9f97117b24158e3202c9dc54bca7a1 100644 (file)
@@ -991,7 +991,7 @@ static struct mmap *get_md(struct evlist *evlist, int cpu)
        for (i = 0; i < evlist->nr_mmaps; i++) {
                struct mmap *md = &evlist->mmap[i];
 
-               if (md->cpu == cpu)
+               if (md->core.cpu == cpu)
                        return md;
        }