All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <ak@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v7 1/2]: perf util: map data buffer for preserving collected data
Date: Thu, 6 Sep 2018 13:04:41 +0200	[thread overview]
Message-ID: <20180906110441.GI8248@krava> (raw)
In-Reply-To: <cf6cd6ca-12dd-9ee8-8e18-ee02f289c45e@linux.intel.com>

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

  parent reply	other threads:[~2018-09-06 11:04 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-05  7:16 [PATCH v7 0/2]: perf: reduce data loss when profiling highly parallel CPU bound workloads Alexey Budankov
2018-09-05  7:19 ` [PATCH v7 1/2]: perf util: map data buffer for preserving collected data Alexey Budankov
2018-09-06 11:04   ` Jiri Olsa
2018-09-06 11:50     ` Alexey Budankov
2018-09-06 11:04   ` Jiri Olsa [this message]
2018-09-06 11:54     ` Alexey Budankov
2018-09-05  7:39 ` [PATCH v7 2/2]: perf record: enable asynchronous trace writing Alexey Budankov
2018-09-06 11:04   ` Jiri Olsa
2018-09-06 11:57     ` Alexey Budankov
2018-09-06 11:04   ` Jiri Olsa
2018-09-06 11:58     ` Alexey Budankov
2018-09-06 11:04   ` Jiri Olsa
2018-09-06 11:59     ` Alexey Budankov
2018-09-06 11:04   ` Jiri Olsa
2018-09-06 12:09     ` Alexey Budankov
2018-09-05 11:28 ` [PATCH v7 0/2]: perf: reduce data loss when profiling highly parallel CPU bound workloads Jiri Olsa
2018-09-05 17:37   ` Alexey Budankov
2018-09-05 18:51     ` Arnaldo Carvalho de Melo
2018-09-06  6:03       ` Alexey Budankov
2018-09-06  8:14         ` Jiri Olsa
2018-09-06  8:20           ` Alexey Budankov
2018-09-06  6:59       ` Alexey Budankov
2018-09-06  6:57   ` Alexey Budankov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180906110441.GI8248@krava \
    --to=jolsa@redhat.com \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexey.budankov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.