I'm trying to understand the functionality of the vmsplice(2)
syscall (man page here). I have two questions about the effect of the SPLICE_F_GIFT
flag:
The man page says that once you gift pages to the kernel, you must never modify the memory again. Does that mean the memory is pinned forever, or does it perhaps refer to virtual memory that can be unmapped by the gifting process, rather than physical memory? In other words, what does a typical use of this look like?
If I don't set
SPLICE_F_GIFT
, isvmsplice(2)
any different than a vectorized write syscall likewritev(2)
?
You are promising not to modify the page. Not the page's virtual addressing. For most use cases the suggest operation is something like:
Generally you want to use
mmap
overmalloc
as you want to ensure you have a page, not just 4096bytes of RAM. Which could sit in the middle of a 2MB, or 1GBHUGE_PAGE
if your allocator determines that is more efficient.Yes
Most buffers in the kernels are pipes. Or really pipes are represented by the same data structure as buffers.