I'm trying to learn more about the swapping system of the linux kernel.
I figured out that if a r/o or a code part of a binary in memory needs to get swapped, it shouldn't be moved to the swap file/partition, because it is already backed by a file in the disk.
Does it actually works that way? pages from r/o or rx allocations backed by a file gets swapped to the dedicated file? If so, can someone please point me to the code that handles this? I can't seem to find it