驱动程序 - 供应vm_operations_struct.fault方法与页面缓存的交互

发布于 2025-02-02 11:26:20 字数 889 浏览 2 评论 0 原文

https://manyybutfinite.com/post/page/page/page/page/page/page/page/page/page/page/page -cache-the-the-affair-betewewement-memory and-files/说“所有常规文件I/O都通过页面缓存发生”(包括用于mmapped文件)。伟大的!

但是,设备驱动程序有权选择通过将 .fault 方法安装到VMA的 vm_operations_strucations_struction_struct_sruct_sustration xpemenp )。

假设由用户空间应用程序对此驱动程序备份的文件以及访问映射的VA页故障的访问。在页面缓存中,哪个物理页面表示文件的该部分?内核是否接受驱动程序的 .fault 方法返回的物理页面作为代表文件部分的“内核”页面缓存条目?还是内核将驱动程序的 .fault 返回的页面复制到其他内核管理的页面,然后将其他页面设置为“官方”页面缓存条目?还是其他事情发生?

事先感谢您的帮助!

https://manybutfinite.com/post/page-cache-the-affair-between-memory-and-files/ says "all regular file I/O happens through the page cache" (including for mmapped files). Great!

However, device drivers have the authority to choose the physical page returned by a page fault to an mmapped VMA, by installing a .fault method to the VMA's vm_operations_struct (example).

Let's say a file backed by such a driver is mmapped by a userspace app, and an access to the mapped VA page faults. What physical page ends up in the page cache representing that section of the file? Does the kernel accept the physical page returned by the driver's .fault method as the "kernel-official" page cache entry representing that section of the file? Or does the kernel take the page returned by the driver's .fault, copy it to some other kernel-managed page, and set that other page as the "official" page cache entry? Or does something else happen?

Thanks in advance for your help!

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文