Swap
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 6 lines
Quoted 4 lines
Yep. There's a reason for that: the kernel is *ALWAYS* able to swap pages out to disk - even without "swap space". Disabling swapspace simply forces the kernel to swap out more code, since it cannot swap out any data.
Sure ??? Where ?? What disk space uses it to swap pages to ?
The executables and binaries on your regular filesystems... Even with no swap space, the kernel can "page out" (i.e. drop from memory) read-only file mappings, since they can always be reloaded from disk if needed.
In other words, there is still a big difference between running without swap space, and having every program do an mlockall() (which *really* forces all pages to be permanently resident in RAM).
Still, it puzzles me why a system with no swap space would appear to be more responsive than one with swap (assuming their working sets are quite a bit smaller than total amount of RAM)... Can you do a controlled test somehow, to rule out any sort of placebo effect?
Regards,
Dan
Quoted 4 lines · Dan Maas
Still, it puzzles me why a system with no swap space would appear to be more responsive than one with swap (assuming their working sets are quite a bit smaller than total amount of RAM)... Can you do a controlled test somehow, to rule out any sort of placebo effect?
It's pretty simple... Try putting as much progs as you can into RAM (but less than total RAM size) when you have RAM+swap. Switching from one prog to another now takes time, because if you need to go e.g. from mozilla to openoffice for example, if openoffice has been swapped, it'll take ages.
Another good example is launching X and a few heavy X apps, going back to console, doing a few things, like compiling different kernel trees. If you have swap, the X + X apps will be swapped. going back to X will take ages, because all that data + code has to be moved out to RAM to cache the data in the two kernel trees.
If you don't have swap, maybe one, or both of the two kernel trees will end up being not cached into main memory, depending on how much RAM left you have. but going back to X will take 1 second instead of 20, and thus the system will be more responsive.
It depends clearly on the situation you're in. I believe running with swap is beneficial when your memory load is more than 75% of total RAM, and less so when you have a few hundred megs of RAM left with all useful apps loaded into RAM (which is not too unlikely these days, due to the low price of SD/DDR RAM).
François
Quoted 24 lines · On Sun, 18 Nov 2001, [ISO-8859-15] François Cami wrote:
Quoted 4 lines · Dan Maas
Still, it puzzles me why a system with no swap space would appear to be more responsive than one with swap (assuming their working sets are quite a bit smaller than total amount of RAM)... Can you do a controlled test somehow, to rule out any sort of placebo effect?
It's pretty simple... Try putting as much progs as you can into RAM (but less than total RAM size) when you have RAM+swap. Switching from one prog to another now takes time, because if you need to go e.g. from mozilla to openoffice for example, if openoffice has been swapped, it'll take ages.
Another good example is launching X and a few heavy X apps, going back to console, doing a few things, like compiling different kernel trees. If you have swap, the X + X apps will be swapped. going back to X will take ages, because all that data + code has to be moved out to RAM to cache the data in the two kernel trees.
If you don't have swap, maybe one, or both of the two kernel trees will end up being not cached into main memory, depending on how much RAM left you have. but going back to X will take 1 second instead of 20, and thus the system will be more responsive.
Quoted 5 lines
It depends clearly on the situation you're in. I believe running with swap is beneficial when your memory load is more than 75% of total RAM, and less so when you have a few hundred megs of RAM left with all useful apps loaded into RAM (which is not too unlikely these days, due to the low price of SD/DDR RAM).
A perfect example of why a system _needs_ tuning knobs - this view of Linus's that we need a self tuning system is idiotic, because some of us don't care how long a kernel compile takes (or even how long it takes to serve a couple of web pages per hour), but _do_ care about the general system responsiveness. The system cannot predict what *I* the user wants out of it. Hence we need /proc interfaces to the the VM that say this is a compiling machine, or this is a desktop machine.....
Signature · 4 lines
TimC -- http://www.physics.usyd.edu.au/~tcon/ cat ~/.signature Passing cosmic ray (core dumped)
Quoted 11 lines
Quoted 5 lines
If you don't have swap, maybe one, or both of the two kernel trees will end up being not cached into main memory, depending on how much RAM left you have. but going back to X will take 1 second instead of 20,
and thus the system will be more responsive.A perfect example of why a system _needs_ tuning knobs - this view of Linus's that we need a self tuning system is idiotic, because some of us don't care how long a kernel compile takes (or even how long it takes to serve a couple of web pages per hour), but _do_ care about the general system responsiveness.
For what it's worth, I heartily agree...
Linus et al might very well say "if you care so much about keeping X in RAM, just mlock() it." This is certainly worth a shot. (though I'd much prefer a configurable 'weight' or 'stickiness' for file mappings vs. cached buffers).
Of course this sort of second-order tuning mechanism is a lot less important than having a VM that doesn't crash or suck badly for common loads =)... (not that the VM has been bad at all lately; I haven't had any problems since 2.4.9-ac10 or 2.4.14, knock on wood...)
Regards,
Dan
Quoted 11 lines · François Cami
Quoted 4 lines · Dan Maas
Still, it puzzles me why a system with no swap space would appear to be more responsive than one with swap (assuming their working sets are quite a bit smaller than total amount of RAM)... Can you do a controlled test somehow, to rule out any sort of placebo effect?
It's pretty simple... Try putting as much progs as you can into RAM (but less than total RAM size) when you have RAM+swap. Switching from one prog to another now takes time, because if you need to go e.g. from mozilla to openoffice for example, if openoffice has been swapped, it'll take ages.
Except that openoffice and mozilla can be swapped out in BOTH cases: the kernel can discard mapped pages and reread as needed, whether you have a swap partition or not.
Quoted 5 lines
Another good example is launching X and a few heavy X apps, going back to console, doing a few things, like compiling different kernel trees. If you have swap, the X + X apps will be swapped. going back to X will take ages, because all that data + code has to be moved out to RAM to cache the data in the two kernel trees.
Whereas without swapspace, only the read-only mapped pages can be swapped out.
Quoted 4 lines
If you don't have swap, maybe one, or both of the two kernel trees will end up being not cached into main memory, depending on how much RAM left you have. but going back to X will take 1 second instead of 20, and thus the system will be more responsive.
You're trading throughput for responsiveness, here: you save 19 seconds switching to/from X, but walking through the two kernel trees will be slowed down by more than that amount... By most metrics, keeping X+apps in memory and forcing your kernel tree accesses to hit the disk is the WRONG strategy.
(Making X mlock() some or all of itself into RAM might make sense here, perhaps?)
Quoted 5 lines
It depends clearly on the situation you're in. I believe running with swap is beneficial when your memory load is more than 75% of total RAM, and less so when you have a few hundred megs of RAM left with all useful apps loaded into RAM (which is not too unlikely these days, due to the low price of SD/DDR RAM).
Provided the VM is doing its job properly, adding swap will always be a net win for efficiency: the kernel is able to dump unused pages to make more room for others. Of course, you tend to "feel" the response times to interactive events, rather than the overall throughput, so a change which slows the system down but makes it more "responsive" to mouse clicks etc feels like a net win...
James.