StagingBuffer: Prefer mlock to io_uring_register_buffers

This commit is contained in:
2025-11-09 01:16:17 -04:00
parent 010ba9c7bd
commit d2e2d9bc3b
3 changed files with 25 additions and 1 deletions
+7
View File
@@ -197,6 +197,13 @@ assemblingFlag(false)
static_cast<uint8_t*>(mmapped), MmapDeleter(bufferNBytes));
currentNBytes.store(0);
// Lock the buffer in memory to prevent swapping
if (mlock(buffer.get(), bufferNBytes) != 0)
{
throw std::runtime_error(std::string(__func__)
+ ": StagingBuffer: mlock() failed");
}
// Calculate offset and validate invariants (helper function in .cpp)
firstSlotOffsetNBytes = StagingBuffer::calculateFirstSlotOffsetAndValidate(
buffer.get(), bufferNBytes, nDgramsPerFrame,