why swap at all?
Quoted 20 lines · Buddy Lumpkin
Quoted 6 lines
Quoted 4 lines
That's true, but it's not a magical property of swap space
- extra physical
RAM would do more or less the same thing.Quoted 6 lines
Well it is a magical property of swap space, because extra RAM doesn't allow you to replace unused memory with often used memory.
The theory holds true no matter how much RAM you have. Swap can improve performance. It can be trivially demonstrated.
I bet you have demonstrated this. It strikes me of an observation that could be made in a lab environment. But your failing to realize that:
1) you will fill physical memory with pages eventually or your not doing work.
Quoted 7 lines
2) pages do not just silently move to the swap device. They move as a result of a memory shortfall
3) once physical memory is full, file system I/O will only benefit from reads that incur a minor fault. All other file system operations are bound by the rate you can reclaim pages from physical memory.
No, typically we can reclaim memory very quickly and the operations are bound by the speed of the block device.
Quoted 5 lines
4) non-filesystem backed pages are still effected the same way, nothing has changed. When you run your next filesystem related operation, those pages will be faulted into physical memory, and something will be evicted to it's backing store (remember, memory is full).
I haven't failed to realise 1, 2 or 4 and I don't know what you are arguing about. All I said was basically "no matter how much ram you have, swap can increase performance by allowing unused anonymous memory to be paged out, thereby increasing your maximum effective RAM".
Quoted 9 lines
Quoted 6 lines
3) once physical memory is full, file system I/O will only benefit from reads that incur a minor fault. All other file system operations are bound
by the rate you can reclaim pages from physical memory.No, typically we can reclaim memory very quickly and the operations are bound by the speed of the block device.
So if all physical memory is full with either pagecache or anonymous memory, where are you going to put these operations that are bound by the speed of the block device?
You have to evict pages at the same rate your reading them in or writing to the filesystem else you have nowhere to put them. This means that the rate you can access the filesystem is governed by the rate you can evict pages from memory.
Couple that with the fact that there are many pte's pointing at the same physical page (shared page) in many cases where many processes are running on the system. Because all of the references to that page must be removed before the page can be evicted, there are some absolute limitations in the rate that pages can be evicted from memory as the number of processes running on the system and the total amount of memory increases.
--Buddy