splice() 中的 DMA 复制

发布于 2024-12-06 20:50:06 字数 299 浏览 1 评论 0原文

我是 Linux 内核的新手。最近,我经历了内核 2.6.33 中的 sendfile 系统调用。以下是我的旅程的序列:

   do_sendfile()
=> do_splice_direct()
=> splice_direct_to_actor()
=> do_splice_to()
=> do_splice_from()
=> splice_read,splice_write

在整个序列中,我没有找到 splice 使用 DMA 副本的地方。那么 DMA 复制发生在哪里呢?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

以歌曲疗慰 2024-12-13 20:50:06

Splice 不执行任何 DMA 复制。事实上,splice 的主要用途是完全避免复制 - 它尝试传递对内存页的引用,而不是复制缓冲区。

提到的与拼接相关的 DMA 将发生在“叶”处 - 拼接将引用传递到周围的这些页面的起源将由磁盘控制器 DMA 创建到缓冲区中,并由以太网控制器 DMA 发送页面内容作为数据包的一部分 - 至少在“完美”的零复制场景中,这是很难实现且罕见的。

Splice 不执行 DMA - 它不会在第一个 DMA 和最后一个 DMA 之间进行复制。

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.

凡间太子 2024-12-13 20:50:06

据我了解, splice_* 基础设施最好最大限度地减少实际复制的数量。读者充其量只是从作者正在填写的同一组页面中阅读。

LWN 上有一些优秀的文章描述了 splice() 的各个部分,包括新的系统调用。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文