brintos

brintos / linux-shallow public Read only

0
0
Text · 1.6 KiB · 297091c Raw
32 lines · plain
1==============================2remap_file_pages() system call3==============================4 5The remap_file_pages() system call is used to create a nonlinear mapping,6that is, a mapping in which the pages of the file are mapped into a7nonsequential order in memory. The advantage of using remap_file_pages()8over using repeated calls to mmap(2) is that the former approach does not9require the kernel to create additional VMA (Virtual Memory Area) data10structures.11 12Supporting of nonlinear mapping requires significant amount of non-trivial13code in kernel virtual memory subsystem including hot paths. Also to get14nonlinear mapping work kernel need a way to distinguish normal page table15entries from entries with file offset (pte_file). Kernel reserves flag in16PTE for this purpose. PTE flags are scarce resource especially on some CPU17architectures. It would be nice to free up the flag for other usage.18 19Fortunately, there are not many users of remap_file_pages() in the wild.20It's only known that one enterprise RDBMS implementation uses the syscall21on 32-bit systems to map files bigger than can linearly fit into 32-bit22virtual address space. This use-case is not critical anymore since 64-bit23systems are widely available.24 25The syscall is deprecated and replaced it with an emulation now. The26emulation creates new VMAs instead of nonlinear mappings. It's going to27work slower for rare users of remap_file_pages() but ABI is preserved.28 29One side effect of emulation (apart from performance) is that user can hit30vm.max_map_count limit more easily due to additional VMAs. See comment for31DEFAULT_MAX_MAP_COUNT for more details on the limit.32