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!
发布评论