Re: [PATCH 4/4] perf record: mmap output file - v3

From: David Ahern
Date: Thu Nov 07 2013 - 11:06:16 EST


On 11/7/13, 1:03 AM, Ingo Molnar wrote:

* David Ahern <dsahern@xxxxxxxxx> wrote:

+--out-pages=::
+ Number of pages to mmap while writing data to file (must be a power of two).
+ Specification can be appended with unit character - B/K/M/G. The
+ size is rounded up to have nearest pages power of two value.

So why doesn't the code automatically round down (or up) to the next power
of 2 limit? We use computers to solve problems, not to introduce
additional ones! ;-)

sure. It reuses perf_evlist__parse_mmap_pages which rounds so I will update the description.



+static int do_mmap_output(struct perf_record *rec, void *buf, size_t size)
+{
+ struct perf_data_file *file = &rec->file;
+ u64 remaining;
+ off_t offset;
+
+ if (rec->mmap_addr == NULL) {
+do_mmap:
+ offset = rec->session->header.data_offset + rec->bytes_written;
+ if (offset < (ssize_t) rec->mmap_out_size) {
+ rec->mmap_offset = offset;
+ offset = 0;
+ } else
+ rec->mmap_offset = 0;

(Nit: unbalanced curly braces.)

I believe checkpatch.pl complains, but will add.


+ OPT_CALLBACK(0, "out-pages", &record.mmap_out_pages, "pages",
+ "number of pages to use for output chunks.",
+ perf_evlist__parse_mmap_pages),

Nit: the short explanation here doesn't mention it at all to the user that
these 'out pages' are used in mmap.

Shouldn't it say:

"number of pages mmap()ed for output chunks."

?

Also, what happens if a user sets it to zero?

I was intending to use that as a way of disabling the mmap output - go back to write(). I'll update the documentation.

Ack on all of the other comments.

David

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