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