Your mmapped file should NOT get swapped to a swap device.
But other memory certainly may! When you touch a lot of your
big mmapped file you create memory pressure. Some of that
pressure writes pages back to your file. Some of that
pressure swaps other programs / other memory out to the
swap device.
In short - memory used to cache your big mmapped file don't merely
compete with memory used for caching other parts of that file.
It competes with all other swappable (or discardable) memory
in the system, and some of that might go to the swap device.
Maybe you only need a little of that big file at a time - but
the VM system cannot know that. It simply looks at _all_
memory, considers "what is recently used, and what is _not_"
and goes on to swap/writeback the latter parts.
> My problem actually is that although I have enough memory to buffer the
> whole area the kernel decides to hit hard on the disc which makes the
> performance suck.
You have enough RAM, but was all of it _free_ according to free?
Lots of it will usually be in use as cache, so something must be
evicted. Cache are freed sometimes, swapping happens at
other times.
Helge Hafting
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/