[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180906110441.GI8248@krava>
Date: Thu, 6 Sep 2018 13:04:41 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Alexey Budankov <alexey.budankov@...ux.intel.com>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v7 1/2]: perf util: map data buffer for preserving
collected data
On Wed, Sep 05, 2018 at 10:19:56AM +0300, Alexey Budankov wrote:
SNIP
> @@ -166,6 +174,7 @@ void perf_mmap__munmap(struct perf_mmap *map)
>
> int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd)
> {
> + int i;
> /*
> * The last one will be done at perf_mmap__consume(), so that we
> * make sure we don't prevent tools from consuming every last event in
> @@ -190,6 +199,50 @@ int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd)
> map->base = NULL;
> return -1;
> }
> + map->nr_cblocks = mp->nr_cblocks;
> + map->cblocks = calloc(map->nr_cblocks, sizeof(struct aiocb*));
> + if (!map->cblocks) {
> + pr_debug2("failed to allocate perf event data buffers, error %d\n",
> + errno);
> + return -1;
> + }
> + map->data = calloc(map->nr_cblocks, sizeof(void*));
> + if (map->data) {
> + int delta_max = sysconf(_SC_AIO_PRIO_DELTA_MAX);
> + for (i = 0; i < map->nr_cblocks; ++i) {
> + map->data[i] = malloc(perf_mmap__mmap_len(map));
> + if (map->data[i]) {
> + int prio;
> + unsigned char *data = map->data[i];
> + map->cblocks[i] = (struct aiocb *)&data[map->mask + 1];
the 'struct aiocb' is allocated at the last page of the buffer?
is that enough space? could we please make this more transparent
and allocate that space separately?
thanks,
jirka
Powered by blists - more mailing lists