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:05:44 EST
On Tue, Jan 12, 2016 at 01:33:28PM +0800, Wangnan (F) wrote:
> >How about another idea:
> >. update data_tail pointer when head is about to overwrite it
> Even in the very first try at 2013 in , reading from the ring
> buffer is avoided. I don't think Peter changes his mind now.
So I don't object to that this approach per-se, as per:
The main concern is doing it so that the regular !overwrite mode doesn't
suffer in performance.
The patch above choses to sacrifice about half the buffer space to avoid
having to fwd parse events on every overwrite, but doing the fwd search
is certainly possible (just really expensive).
> >Another concern is validity of records stored. If user space messes
> >with ring-buffer, kernel won't be able to move data_tail properly
> >and would need to indicate that to userspace somehow.
> >But memory saving of 8 bytes per record could be sizable
> Yes. But I have already discussed with Peter on this in .
So given the trade-off between loosing half the buffer and adding 8
bytes to every event I'm not sure which is the worst.
Also, the way its implemented means they're not in fact mutually
exclusive, both can be had.