开发者

DMA copy in splice()

I am new to linux kernel. A开发者_StackOverflow中文版nd 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.


As I understand it the splice_* infrastructure does it's very best to minimise the amount of actual copying that is done. At best the reader is reading from the same set of pages the writer is filling.

There are some excellent articles on LWN describing the various bits of splice() including the new system call.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜