Re: [RFC 1/2] perf: add data_{offset,size} to user_page

From: Robert Richter
Date: Thu May 15 2014 - 14:14:16 EST


On 15.05.14 18:08:29, Alexander Shishkin wrote:
> @@ -488,9 +488,14 @@ struct perf_event_mmap_page {
> * In this case the kernel will not over-write unread data.
> *
> * See perf_output_put_handle() for the data ordering.
> + *
> + * data_{offset,size} indicate the location and size of the perf record
> + * buffer within the mmapped area.
> */
> __u64 data_head; /* head in the data section */
> __u64 data_tail; /* user-space written tail */
> + __u64 data_offset; /* where the buffer starts */
> + __u64 data_size; /* data buffer size */
> };

Yeah, we need something like this also for other reasons. For
persistent events we don't know the buffer size when mmaping
existing/shared buffers. To determine the buffer size we could map the
first page only, read the size and then mremap() to the actual size.

Please keep this use case in mind too, also for the aux buffer. The
best would be if data_size is the mmap size.

Thanks,

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