Re: [PATCH v7 2/2]: perf record: enable asynchronous trace writing

From: Jiri Olsa
Date: Thu Sep 06 2018 - 07:04:23 EST


On Wed, Sep 05, 2018 at 10:39:25AM +0300, Alexey Budankov wrote:

SNIP

> diff --git a/tools/perf/util/mmap.c b/tools/perf/util/mmap.c
> index 384d17cd1379..1d57d8387caf 100644
> --- a/tools/perf/util/mmap.c
> +++ b/tools/perf/util/mmap.c
> @@ -332,12 +332,12 @@ int perf_mmap__read_init(struct perf_mmap *map)
> return __perf_mmap__read_init(map);
> }
>
> -int perf_mmap__push(struct perf_mmap *md, void *to,
> - int push(void *to, void *buf, size_t size))
> +int perf_mmap__push(struct perf_mmap *md, void *to, int idx,
> + int push(void *to, struct aiocb *cblock, void *data, size_t size))
> {
> u64 head = perf_mmap__read_head(md);
> unsigned char *data = md->base + page_size;
> - unsigned long size;
> + unsigned long size, size0 = 0;
> void *buf;
> int rc = 0;
>
> @@ -345,31 +345,58 @@ int perf_mmap__push(struct perf_mmap *md, void *to,
> if (rc < 0)
> return (rc == -EAGAIN) ? 0 : -1;
>
> + /* md->base data is copied into md->data[idx] buffer to
> + * release space in the kernel buffer as fast as possible,

please start the comment with the extra '/*', like:

/*
* md->base data is copied into md->data[idx] buffer to
* release space in the kernel buffer as fast as possible,
...

jirka