"Boyd Stephen Smith Jr." <bss03@...> posted
200701120717.07604.bss03@..., excerpted below, on Fri, 12 Jan
2007 07:16:53 -0600:
> Or, on a system where (e.g.) /home is on RAID 6 across 5 disks, and swap is
> on RAID 0 across 5 disks (same disks possibly). In this case I/O to swap
> is nearly twice as fast, so it may be reasonable to sometimes swap out
> pages that are backed by files or even *filesystem cache*. This is, in
> fact, fairly similar to my current setup.
That's very similar to mine, also, actually. Only here it's a four-disk
SATA array, root, root-bak, and an LVM2 hosting partitioned RAID-6
containing most of the system, a RAID-1 /boot, a RAID-0/striped portage
tree and temp/scratch/cache space, and /tmp (with /var/tmp symlinked to
it) as tmpfs putting part of my 8 gig physical memory to use. Swap is a
partition on each of the four drives, set equal priority so the kernel
stripes them too.
The thing is, however, that if it's read in from disk only to be written
out to the swap aka paging device, and it's read-only, you are doing
enough additional work to counteract most of the speed gain of even much
faster swap, in addition to forcing one to have that much bigger a swap
device because it's stored both there and on the regular filesystem.
Rather, the kernel just memory-maps the file in from its original
location, not even loading it into actual memory unless it's actually
needed. No load, only to turn around and write it back out to swap. If
it IS loaded into memory because it's actually used, it's either going to
be used enough to keep it in cache most of the time, or it's not going to
be used all that much, and if the memory needs reclaimed, the kernel
simply dumps the physical memory without having to bother writing it to
swap since the file is memory-mapped directly on disk as it is. Swap
would have to be several times (way more than twice) as fast in ordered to
even theoretically make it worth all those additional still-slow I/O
It's also worth noting that it's a reasonable assumption that a company or
individual having enough money to do the fast striped RAID swap, generally
has enough money to buy a reasonable amount of memory as well, thus
avoiding routine operational use of swap. While swap may be used some,
it's normally not going to be used enough to make the extra I/O worth it
to actually read the file in and then page it out to swap, just so it's on
the faster swap.
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
email@example.com mailing list