Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) .. _remap_file_pages:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) remap_file_pages() system call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) The remap_file_pages() system call is used to create a nonlinear mapping,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) that is, a mapping in which the pages of the file are mapped into a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) nonsequential order in memory. The advantage of using remap_file_pages()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) over using repeated calls to mmap(2) is that the former approach does not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) require the kernel to create additional VMA (Virtual Memory Area) data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) structures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) Supporting of nonlinear mapping requires significant amount of non-trivial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) code in kernel virtual memory subsystem including hot paths. Also to get
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) nonlinear mapping work kernel need a way to distinguish normal page table
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) entries from entries with file offset (pte_file). Kernel reserves flag in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) PTE for this purpose. PTE flags are scarce resource especially on some CPU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) architectures. It would be nice to free up the flag for other usage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) Fortunately, there are not many users of remap_file_pages() in the wild.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) It's only known that one enterprise RDBMS implementation uses the syscall
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) on 32-bit systems to map files bigger than can linearly fit into 32-bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) virtual address space. This use-case is not critical anymore since 64-bit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) systems are widely available.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) The syscall is deprecated and replaced it with an emulation now. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) emulation creates new VMAs instead of nonlinear mappings. It's going to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) work slower for rare users of remap_file_pages() but ABI is preserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) One side effect of emulation (apart from performance) is that user can hit
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) vm.max_map_count limit more easily due to additional VMAs. See comment for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) DEFAULT_MAX_MAP_COUNT for more details on the limit.