Conversation
Signed-off-by: usamasaqib <[email protected]>
e0bad69 to
dcc6137
Compare
| // Therefore the true size is half the size of the mmaped region | ||
| func (rr *ringReader) size() int { | ||
| return cap(rr.ring) | ||
| return cap(rr.ring) / 2 |
There was a problem hiding this comment.
I think you need to fix TestRingbufReader to accommodate this change.
|
Here we Line 27 in c959fd7 I'm not yet sure about the proposed change. Maybe updating the documentation to |
|
As the person who added |
Hey @florianl, in the mmap call we set the size as As Bryce mentioned, |
Signed-off-by: usamasaqib <[email protected]>
Signed-off-by: Florian Lehner <[email protected]>
|
Thanks all! |
The data pages of a ring buffer are mapped twice in a contiguous virtual region to allow easy wrap around when writing data. The code returns the ring size as the capacity of this mmaped region. However, this is wrong since the kernel double maps the underlying pages.
This PR fixes this by reporting the ring size as half the capacity of the underlying mmap region.