I am new to linux kernel. And recently, i’ve went through the sendfile syscall in kernel 2.6.33. The following is the sequence of my journey:
do_sendfile()
=> do_splice_direct()
=> splice_direct_to_actor()
=> do_splice_to()
=> do_splice_from()
=> splice_read,splice_write
Throughout this sequence, I didn’t find the place where splice use the DMA copy. So where is the DMA copying taking place?
Splice doesn’t do any DMA copy. In fact the major usage of splice is to avoid copying at all – it tries to pass references to memory pages instead of copying the buffers.
The DMA mentioned in relation to splice will happen at the “leaf” – The origin of these pages that splice passes references to around will be created by, for example, a disk controller DMA into the buffer and will be sent by an Ethernet controller DMA of the content of the page as part of the packet – at least in a “perfect” zero copy sceanrio, which is difficult to achieve and rare.
Splice doesn’t do the DMA – it enables no copying between the first DMA to the last.