Re: [PATCH] perf core: Introduce new ioctl options to pause and resume ring buffer

From: Peter Zijlstra
Date: Mon Jan 18 2016 - 07:02:46 EST


On Mon, Jan 18, 2016 at 11:52:01AM +0000, Wang Nan wrote:

> +#define PERF_EVENT_IOC_PAUSE_OUTPUT _IO ('$', 9)
> +#define PERF_EVENT_IOC_RESUME_OUTPUT _IO ('$', 10)

Would not a single IOCTL with a 'boolean' parameter make more sense?

> +++ b/kernel/events/ring_buffer.c
> @@ -125,7 +125,7 @@ int perf_output_begin(struct perf_output_handle *handle,
> if (unlikely(!rb))
> goto out;
>
> - if (unlikely(!rb->nr_pages))
> + if (unlikely(rb->paused))
> goto out;

Should we increment rb->lost in this case?