0001 .. _remap_file_pages:
0002
0003 ==============================
0004 remap_file_pages() system call
0005 ==============================
0006
0007 The remap_file_pages() system call is used to create a nonlinear mapping,
0008 that is, a mapping in which the pages of the file are mapped into a
0009 nonsequential order in memory. The advantage of using remap_file_pages()
0010 over using repeated calls to mmap(2) is that the former approach does not
0011 require the kernel to create additional VMA (Virtual Memory Area) data
0012 structures.
0013
0014 Supporting of nonlinear mapping requires significant amount of non-trivial
0015 code in kernel virtual memory subsystem including hot paths. Also to get
0016 nonlinear mapping work kernel need a way to distinguish normal page table
0017 entries from entries with file offset (pte_file). Kernel reserves flag in
0018 PTE for this purpose. PTE flags are scarce resource especially on some CPU
0019 architectures. It would be nice to free up the flag for other usage.
0020
0021 Fortunately, there are not many users of remap_file_pages() in the wild.
0022 It's only known that one enterprise RDBMS implementation uses the syscall
0023 on 32-bit systems to map files bigger than can linearly fit into 32-bit
0024 virtual address space. This use-case is not critical anymore since 64-bit
0025 systems are widely available.
0026
0027 The syscall is deprecated and replaced it with an emulation now. The
0028 emulation creates new VMAs instead of nonlinear mappings. It's going to
0029 work slower for rare users of remap_file_pages() but ABI is preserved.
0030
0031 One side effect of emulation (apart from performance) is that user can hit
0032 vm.max_map_count limit more easily due to additional VMAs. See comment for
0033 DEFAULT_MAX_MAP_COUNT for more details on the limit.