Documentation/translations/zh_CN/mm/remap_file_pages.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/mm/remap_file_pages.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/mm/remap_file_pages.rst- Extension
.rst- Size
- 1647 bytes
- Lines
- 33
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
:Original: Documentation/mm/remap_file_pages.rst
:翻译:
司延腾 Yanteng Si <siyanteng@loongson.cn>
:校译:
==============================
remap_file_pages()系统调用
==============================
remap_file_pages()系统调用被用来创建一个非线性映射,也就是说,在这个映射中,
文件的页面被无序映射到内存中。使用remap_file_pages()比重复调用mmap(2)的好
处是,前者不需要内核创建额外的VMA(虚拟内存区)数据结构。
支持非线性映射需要在内核虚拟内存子系统中编写大量的non-trivial的代码,包括热
路径。另外,为了使非线性映射工作,内核需要一种方法来区分正常的页表项和带有文件
偏移的项(pte_file)。内核为达到这个目的在PTE中保留了标志。PTE标志是稀缺资
源,特别是在某些CPU架构上。如果能腾出这个标志用于其他用途就更好了。
幸运的是,在生活中并没有很多remap_file_pages()的用户。只知道有一个企业的RDBMS
实现在32位系统上使用这个系统调用来映射比32位虚拟地址空间线性尺寸更大的文件。
由于64位系统的广泛使用,这种使用情况已经不重要了。
syscall被废弃了,现在用一个模拟来代替它。仿真会创建新的VMA,而不是非线性映射。
对于remap_file_pages()的少数用户来说,它的工作速度会变慢,但ABI被保留了。
仿真的一个副作用(除了性能之外)是,由于额外的VMA,用户可以更容易达到
vm.max_map_count的限制。关于限制的更多细节,请参见DEFAULT_MAX_MAP_COUNT
的注释。
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.