On Tue, Jan 12, 2016 at 01:33:28PM +0800, Wangnan (F) wrote:
quoted
How about another idea:
. update data_tail pointer when head is about to overwrite it
Even in the very first try at 2013 in [1], 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:
lkml.kernel.org/r/20151023151205.GW11639@twins.programming.kicks-ass.net
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).
quoted
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 [2].
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.