3 ms·
Saying it's like "adding a new swap file that is only to be used for the contents of that specific file" isn't really correct. Swap works by letting the kernel
by mort96 4y ago
Saying it's like "adding a new swap file that is only to be used for the contents of that specific file" isn't really correct.
Swap works by letting the kernel write a memory page to the swap file/partition. After it has done that, the memory is marked as backed by a filesystem (i.e it's no longer anonymous), and the region of physical RAM can be repurposed for something else. With mmap'd files, the memory is always backed by a filesystem; there are no writes, and the physical memory can be discarded at any time.