Re: [PATCH 27/53] perf/core: Put size of a sample at the end of it by PERF_SAMPLE_TAILSIZE

From: Peter Zijlstra
Date: Tue Jan 12 2016 - 09:14:50 EST

On Mon, Jan 11, 2016 at 01:48:18PM +0000, Wang Nan wrote:
> Before reading such ring buffer, perf must ensure all events which may
> output to it is already stopped, so the 'head' pointer it get is the
> end of the last record.

We could add an extra ioctl() to pause/resume ring-buffer output to make
this more convenient to achieve.

Say replace the !rb->nr_pages test in perf_output_begin() with a control
variable load and ensure its set to pause/fail when !nr_pages.

That way we only have to issue a single ioctl to freeze the buffer,
without adding extra instructions/loads to the fast path.