Re: [PATCH 06/13] perf tools: Use tid in mmap/mmap2 events to find maps

From: Adrian Hunter
Date: Wed Mar 19 2014 - 03:14:36 EST


On 18.03.2014 23:25, Arnaldo Carvalho de Melo wrote:
> From: Don Zickus <dzickus@xxxxxxxxxx>
>
> Now that we can properly synthesize threads system-wide, make sure the
> mmap and mmap2 events use tids instead of pids to locate their maps.

This is a good change but it cannot go yet because it is dependent on Jiri's
"perf tools: Share map groups within process" series.

perf tools assume that threads share virtual memory. That means that a
mapping created by one thread is visible to all threads in the thread group.
That was implemented by putting all the maps on the thread group leader
(pid == tid). The alternative is to share the map groups instead, which is
what Jiri is doing.

>
> Signed-off-by: Don Zickus <dzickus@xxxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Stephane Eranian <eranian@xxxxxxxxxx>
> Link: http://lkml.kernel.org/r/1393429527-167840-3-git-send-email-dzickus@xxxxxxxxxx
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> ---
> tools/perf/tests/hists_link.c | 1 +
> tools/perf/util/machine.c | 4 ++--
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
> index 2b6519e0e36f..7ccbc7b6ae77 100644
> --- a/tools/perf/tests/hists_link.c
> +++ b/tools/perf/tests/hists_link.c
> @@ -101,6 +101,7 @@ static struct machine *setup_fake_machine(struct machines *machines)
> .mmap = {
> .header = { .misc = PERF_RECORD_MISC_USER, },
> .pid = fake_mmap_info[i].pid,
> + .tid = fake_mmap_info[i].pid,
> .start = fake_mmap_info[i].start,
> .len = 0x1000ULL,
> .pgoff = 0ULL,
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index d280bf210183..a53cd0b8c151 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -1027,7 +1027,7 @@ int machine__process_mmap2_event(struct machine *machine,
> }
>
> thread = machine__findnew_thread(machine, event->mmap2.pid,
> - event->mmap2.pid);
> + event->mmap2.tid);
> if (thread == NULL)
> goto out_problem;
>
> @@ -1075,7 +1075,7 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event
> }
>
> thread = machine__findnew_thread(machine, event->mmap.pid,
> - event->mmap.pid);
> + event->mmap.tid);
> if (thread == NULL)
> goto out_problem;
>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/