Re: why swap at all?

From: Bill Davidsen
Date: Fri Jun 04 2004 - 12:32:56 EST


Catalin BOIE wrote:
Hello!

But swap behaviour kills performance even when memory is more than adequate. Consider building a DVD image in a 4GB system. The i/o forces all of the unused programs out, in spite of the fact that an extra 100MB doesn't make a measurable difference in performance. But when I click Mozilla paging most of it in from disk make a big difference in performance to the user.


I think that kernel cannot know that you need some data once or more.
This is fadvise for.
With my wrapper (http://kernel.umbrella.ro) for fadvise you can do this:
NOCA_SIZE=128 NOCA_READ=1 NOCA_WRITE=1 NOCA_RA=1 \
noca mkisofs -R -o /tmp/1.iso /tmp/data

This means:
NOCA_SIZE: Call fadvise only after 128KiB was read/wrote.
NOCA_RA: call fadvise with POSIX_FADV_SEQUENTIAL
NOCA_READ: use fadvise(POSIX_FADV_DONTNEED) for reads (because you don't need anymore the source files)
NOCA_WRITE: use fadvise(POSIX_FADV_DONTNEED) for writes (because it's useless to cache the end of the ISO)

Do this program resolve your problem?

It addresses one of the cases which trigger problems, certainly. Thank you.

The problems with small memory are different in kind, when not even the programs will fit in memory at the same time, or will leave next to nothing for i/o, swap is required for performance. But on a large memory system I believe the gain to pain ratio is way too low with the current VM. The solution at the moment is to turn off swap, which as you note has other problems (can't move between zones without swap?) which in theory could really hang a system.


--
-bill davidsen (davidsen@xxxxxxx)
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/