Re: [RFC/PATCH 03/38] perf tools: Move auxtrace_mmap field to struct perf_evlist

From: Jiri Olsa
Date: Mon Oct 05 2015 - 09:14:43 EST


On Fri, Oct 02, 2015 at 02:18:44PM +0900, Namhyung Kim wrote:

SNIP

> @@ -838,7 +841,7 @@ void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx)
> perf_mmap__write_tail(md, old);
> }
>
> - if (atomic_read(&md->refcnt) == 1 && perf_mmap__empty(md))
> + if (atomic_read(&md->refcnt) == 1 && perf_evlist__mmap_empty(evlist, idx))
> perf_evlist__mmap_put(evlist, idx);
> }
>
> @@ -879,7 +882,7 @@ static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx)
> evlist->mmap[idx].base = NULL;
> atomic_set(&evlist->mmap[idx].refcnt, 0);
> }
> - auxtrace_mmap__munmap(&evlist->mmap[idx].auxtrace_mmap);
> + auxtrace_mmap__munmap(&evlist->auxtrace_mmap[idx]);
> }
>
> void perf_evlist__munmap(struct perf_evlist *evlist)
> @@ -901,7 +904,15 @@ static int perf_evlist__alloc_mmap(struct perf_evlist *evlist)
> if (cpu_map__empty(evlist->cpus))
> evlist->nr_mmaps = thread_map__nr(evlist->threads);
> evlist->mmap = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap));
> - return evlist->mmap != NULL ? 0 : -ENOMEM;
> + if (evlist->mmap == NULL)
> + return -ENOMEM;
> + evlist->auxtrace_mmap = calloc(evlist->nr_mmaps,
> + sizeof(struct auxtrace_mmap));
> + if (evlist->auxtrace_mmap == NULL) {
> + zfree(&evlist->mmap);
> + return -ENOMEM;
> + }

can't see evlist->auxtrace_mmap being freed

jirka
--
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/