"Boyd Stephen Smith Jr." <bss03@...> posted
200701111413.31743.bss03@..., excerpted below, on Thu, 11 Jan
2007 14:13:19 -0600:
> [I'm a little fuzzy here as to weather a read-only
> page is ever written to actual swap space, the kernel may just remember
> where (on disk) the original is keep and release the real memory page.]
>From all I've read, Linux never rewrites to swap a clean page held
elsewhere on disk. Swap is for "anonymous" memory only, that is, memory
not backed by files elsewhere on the system. We have COW (copy on write)
here once again. If you are editing a file, until that little "modified"
indicator comes on, Linux considers the memory disk-backed by the file
itself. As soon as the copy in memory is modified, until it is saved, it
becomes "anonymous" memory, NOT backed by that file on disk, and thus
subject to being written to swap, until such time as the save is done, the
memory marked clean once again, the swap space it took if it had been
swapped out marked free, and the memory is mapped once again to the file
as it exists on disk, until the next modification yet again...
That's for local disk, anyway. It's very possibly (and reasonably so)
different with NFS and other remote file systems, where local swap may be
rather faster and more dependable than access to the remote file system.
I'd assume files on those are treated as anonymous memory for
reliability and performance reasons, with memory mapped files being
written to swap accordingly. Of course, FUSE will operate by rather
different (and unknown to me) rules as well, given it operates in
userspace. As such, I'd guess the kernel treats them as unreliable and
thus files mapped off of them as anonymous (read to-swap) memory, avoiding
the complications sure to follow if it is indeed found unreliable.
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
firstname.lastname@example.org mailing list