Question about vmsplice + SPLICE_F_GIFT
Hello everybody,
I am not sure if this is the right place to be asking this. If is not, I apologize for the inconvenience. Also, please tell me where is a better way to as these questions.
I am trying to create a basic C code to test vmsplice + SPLICE_F_GIFT for moving memory pages between two processes without copying.
I have followed the man pages and several recipes across the web, but I could not reproduce it yet.
Basically, I am doing:
Sending process:
- malloc + memcpy for generating pages to transfer
- vmsplice with SPLICE_F_GIFT sending over named pipe (in a loop) Receiving process:
- Create mmaped file to receive the pages
- splice with SPLICE_F_MOVE receiving from named pipe (in a loop)
I have seen the SPLICE_F_MOVE being used on steal ops from the 'pipebuffer', but I couldn't find a way to call it from splice.
Questions:
It does what I think it does? (reassign memory pages from a process to another)
If so, does page gifting still works?
If so, is there a basic recipe to test it's workings?
Thank you for reading,
Leonardo Brás
Quoted 2 lines · Leonardo Bras
I have seen the
SPLICE_F_MOVEbeing used on steal ops from the 'pipebuffer', but I couldn't find a way to call it from splice.
Sorry, typo here. I meant:
Quoted 1 line
I have seen the
SPLICE_F_GIFTbeing used on steal ops [...]
Quoted 13 lines · Leonardo Bras
Hello everybody,
I am not sure if this is the right place to be asking this. If is not, I apologize for the inconvenience. Also, please tell me where is a better way to as these questions.
I am trying to create a basic C code to test vmsplice +
SPLICE_F_GIFTfor moving memory pages between two processes without copying.I have followed the man pages and several recipes across the web, but I could not reproduce it yet.
Quoted 7 lines
Basically, I am doing:
Sending process:
- malloc + memcpy for generating pages to transfer
- vmsplice withSPLICE_F_GIFTsending over named pipe (in a loop) Receiving process:
- Create mmaped file to receive the pages
- splice withSPLICE_F_MOVEreceiving from named pipe (in a loop)
As the splice(2) man page says SPLICE_F_MOVE is currently a no-op.
Quoted 9 lines
I have seen the
SPLICE_F_MOVEbeing used on steal ops from the 'pipebuffer', but I couldn't find a way to call it from splice.Questions:
It does what I think it does? (reassign memory pages from a process to another)If so, does page gifting still works?
If so, is there a basic recipe to test it's workings?
What is the end goal?
It is easy to transfer pages using shared memory (see shm_open(3) and related API), so why mess with splice?
Thanks,
Miklos