Re: [PATCH 3/3] perf record: mmap output file

From: Ingo Molnar
Date: Wed Oct 16 2013 - 03:11:28 EST



* David Ahern <dsahern@xxxxxxxxx> wrote:

> On 10/15/13 10:06 AM, Ingo Molnar wrote:

> > splice() is very fast and should be able to process a lot of pages in
> > one go, so the feedback loop should be pretty weak. mmap() triggers
> > kernel code as well, every time we run out of the 64 MB window we got
> > to remap it, right?
>
>
> Yes, 1 mmap, 1 munmap for every 64MB. Compare to the write() case which
> calls write() for each mmap each time through the mmap_read loop.
>
> I am conjecturing that splice would follow the write model in the sense
> of a ring buffer has N bytes, call splice to copy the data from the ring
> buffer to the file. So, splice saves on the memcpy, but not the
> syscalls.

Well, splice can be 64 MB granular as well - but it depends on how
buffered the pipes are (splice always uses pipes to shuffle around pages).

It's possible to have pipes with larger buffering - see F_SETPIPE_SZ. The
current limit (for unprivileged users?) is:

fs/pipe.c:unsigned int pipe_max_size = 1048576;

[But I haven't actually used this to increase splice() size yet.]

Thanks,

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