6 ms·
As @mitxela says, if you need to fault in a page which is needed for some critical OS function, which requires going through the VFS layer, and that requires pa
by angry_octet 4d ago
As @mitxela says, if you need to fault in a page which is needed for some critical OS function, which requires going through the VFS layer, and that requires paging in another page, which has been swapped out due to memory pressure ... There are many edge cases.
Swap on primary partitions also complicates dump and restore, although hardly anyone seems to know what backups are now.
- ButlerianJihad 4d agoSee, the thing is that swapping or paging to a file does not use the VFS layer, except when activating or deactivating it. So swapfiles may not be materially different from swap partitions during operations. https://utcc.utoronto.ca/~cks/space/blog/linux/HowSwapFindsBlocks https://utcc.utoronto.ca/~cks/space/blog/linux/HowSwapFindsB... And there are many things that complicate dump and restore. Dump and restore often need to account for what partitions were created, anyway, so don't swap partitions also complicate it? https://utcc.utoronto.ca/~cks/space/blog/sysadmin/SwapfileAndBackupsIssue https://utcc.utoronto.ca/~cks/space/blog/sysadmin/SwapfileAn...
- angry_octet 4d agoThe swap files do use a non+VFS path after setup in 2.6+ kernels, but it is complex and has had bugs: https://lkml.iu.edu/hypermail/linux/kernel/2103.0/06524.html https://lkml.iu.edu/hypermail/linux/kernel/2103.0/06524.html The bug is in here: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=48d15436fde6feebcded7bd0fdc8ea4a9181b8fa https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin... This was 2021, and while this bug is fixed, maybe take Linus's advice. Rely on a partition for primary swap, and only add files if you need to. Don't put them on the root partition, preferably a second disk. I can't resolve your links but this is a good reference: https://kernel-internals.org/mm/swapping/ https://kernel-internals.org/mm/swapping/ Normally dump skips swap partitions entirely, and doesn't know anything about partitioning. Swap will refuse to activate on a non-mkswap partition so there is reasonable protection when you're migrating.
- angry_octet 4d agoBTW you can swap over NFS and iSCSI with swap files, with NFSoIB, or use the Infiniswap modules: https://github.com/SymbioticLab/Infiniswap https://github.com/SymbioticLab/Infiniswap Great hack for when you have a massive working set but don't want to rewrite the code to be distributed/parallel.