public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Alexey Budankov <alexey.budankov@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Andi Kleen <ak@linux.intel.com>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/4] perf record: implement -z=<level> and --mmap-flush=<thres> options
Date: Tue, 12 Feb 2019 14:08:11 +0100	[thread overview]
Message-ID: <20190212130811.GA775@krava> (raw)
In-Reply-To: <2d676199-bfe0-d8e0-442e-41280046f819@linux.intel.com>

On Mon, Feb 11, 2019 at 11:22:38PM +0300, Alexey Budankov wrote:

SNIP

>  static int process_synthesized_event(struct perf_tool *tool,
>  				     union perf_event *event,
>  				     struct perf_sample *sample __maybe_unused,
> @@ -543,7 +574,8 @@ static int record__mmap_evlist(struct record *rec,
>  	if (perf_evlist__mmap_ex(evlist, opts->mmap_pages,
>  				 opts->auxtrace_mmap_pages,
>  				 opts->auxtrace_snapshot_mode,
> -				 opts->nr_cblocks, opts->affinity) < 0) {
> +				 opts->nr_cblocks, opts->affinity,
> +				 opts->mmap_flush) < 0) {
>  		if (errno == EPERM) {
>  			pr_err("Permission error mapping pages.\n"
>  			       "Consider increasing "
> @@ -734,7 +766,7 @@ static void record__adjust_affinity(struct record *rec, struct perf_mmap *map)
>  }
>  
>  static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evlist,
> -				    bool overwrite)
> +				    bool overwrite, bool sync)
>  {
>  	u64 bytes_written = rec->bytes_written;
>  	int i;
> @@ -757,12 +789,19 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
>  		off = record__aio_get_pos(trace_fd);
>  
>  	for (i = 0; i < evlist->nr_mmaps; i++) {
> +		u64 flush = MMAP_FLUSH_DEFAULT;
>  		struct perf_mmap *map = &maps[i];
>  
>  		if (map->base) {
>  			record__adjust_affinity(rec, map);
> +			if (sync) {
> +				flush = map->flush;
> +				map->flush = MMAP_FLUSH_DEFAULT;
> +			}
>  			if (!record__aio_enabled(rec)) {
>  				if (perf_mmap__push(map, rec, record__pushfn) != 0) {
> +					if (sync)
> +						map->flush = flush;
>  					rc = -1;
>  					goto out;
>  				}
> @@ -775,10 +814,14 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
>  				idx = record__aio_sync(map, false);
>  				if (perf_mmap__aio_push(map, rec, idx, record__aio_pushfn, &off) != 0) {
>  					record__aio_set_pos(trace_fd, off);
> +					if (sync)
> +						map->flush = flush;
>  					rc = -1;
>  					goto out;
>  				}
>  			}
> +			if (sync)
> +				map->flush = flush;
>  		}

what's 'flush' and 'sync' for? also the above handling seems confusing,
why would you set it temporarily for default value if you let it set
by user command line option?

SNIP

> -static void perf_mmap__aio_munmap(struct perf_mmap *map __maybe_unused)
> +static void perf_mmap__aio_munmap_blocks(struct perf_mmap *map __maybe_unused)
>  {
>  }
>  #endif
> @@ -444,6 +468,8 @@ int perf_mmap__mmap(struct perf_mmap *map, struct mmap_params *mp, int fd, int c
>  				&mp->auxtrace_mp, map->base, fd))
>  		return -1;
>  
> +	map->flush = mp->flush;
> +
>  	return perf_mmap__aio_mmap(map, mp);
>  }
>  
> @@ -492,7 +518,7 @@ static int __perf_mmap__read_init(struct perf_mmap *md)
>  	md->start = md->overwrite ? head : old;
>  	md->end = md->overwrite ? old : head;
>  
> -	if (md->start == md->end)
> +	if ((md->end - md->start) < md->flush)
>  		return -EAGAIN;

we need document and explain this change in changelog in separate patch

thanks,
jirka

  reply	other threads:[~2019-02-12 13:08 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 20:17 [PATCH v2 0/4] perf: enable compression of record mode trace to save storage space Alexey Budankov
2019-02-11 20:21 ` [PATCH v2 1/4] feature: realize libzstd check, LIBZSTD_DIR and NO_LIBZSTD defines Alexey Budankov
2019-02-11 20:22 ` [PATCH v2 2/4] perf record: implement -z=<level> and --mmap-flush=<thres> options Alexey Budankov
2019-02-12 13:08   ` Jiri Olsa [this message]
2019-02-20 14:13     ` Alexey Budankov
2019-02-12 13:08   ` Jiri Olsa
2019-02-20 14:13     ` Alexey Budankov
2019-02-12 13:08   ` Jiri Olsa
2019-02-20 15:24     ` Alexey Budankov
2019-02-21  9:49       ` Jiri Olsa
2019-02-21 11:24         ` Alexey Budankov
2019-02-25 15:27           ` Alexey Budankov
2019-02-12 13:08   ` Jiri Olsa
2019-02-20 14:15     ` Alexey Budankov
2019-02-21  9:47       ` Jiri Olsa
2019-02-21 11:23         ` Alexey Budankov
2019-02-25 15:26           ` Alexey Budankov
2019-02-12 13:08   ` Jiri Olsa
2019-02-20 14:13     ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 15:19     ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 14:25     ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 14:14     ` Alexey Budankov
2019-02-25 15:30       ` Alexey Budankov
2019-02-11 20:23 ` [PATCH v2 3/4] perf record: enable runtime trace compression Alexey Budankov
2019-02-12 13:08   ` Jiri Olsa
2019-02-20 15:13     ` Alexey Budankov
2019-02-21  9:43       ` Jiri Olsa
2019-02-21 11:30         ` Alexey Budankov
2019-02-12 13:08   ` Jiri Olsa
2019-02-20 14:53     ` Alexey Budankov
2019-02-21  9:43       ` Jiri Olsa
2019-02-21 11:18         ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 15:09     ` Alexey Budankov
2019-02-25 15:27       ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 15:11     ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 15:03     ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 15:06     ` Alexey Budankov
2019-02-11 20:25 ` [PATCH v2 4/4] perf report: support record trace file decompression Alexey Budankov
2019-02-12 13:08   ` Jiri Olsa
2019-02-20 15:19     ` Alexey Budankov
2019-02-25 15:28       ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 14:48     ` Alexey Budankov
     [not found]       ` <0132ec08-e28b-4102-5053-8f8e21e7fd44@linux.intel.com>
2019-02-27 10:56         ` Alexey Budankov
2019-02-27 11:17           ` Jiri Olsa
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 14:46     ` Alexey Budankov
2019-02-12 13:09   ` Jiri Olsa
2019-02-20 14:44     ` Alexey Budankov
2019-02-12 12:27 ` [PATCH v2 0/4] perf: enable compression of record mode trace to save storage space Arnaldo Carvalho de Melo
2019-02-12 14:06   ` Alexey Budankov
  -- strict thread matches above, loose matches on Subject: below --
2019-01-28  7:02 Alexey Budankov
2019-01-28  7:08 ` [PATCH v2 2/4] perf record: implement -z=<level> and --mmap-flush=<thres> options 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=20190212130811.GA775@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@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox