Skip to contentSkip to conversation

Swap vs No Swap.

DISCUSSION war 16 participants 36 messages Nov 22, 2001 – Nov 23, 2001

lore
Share & tools
lore

war

author
#0 lore raw

I do not understand something.

How can having swap speed ANYTHING up?

RAM = 1000MB/s.
DISK = 10MB/s

Ram is generally 1000x faster than a hard disk.

No swap = fastest possible solution.

#1 lore raw
Quoted 1 line · war

No swap = fastest possible solution.

assuming you can safely run without swap yes...

In many cases paging out processes you're not using can free up memoery for useful things like caching disk writes...

for a significant number of people running without swap isn't an option.

if you have fine grained control over how much of your memory is used by your apps then running without swap can be a resonable option...

6:19pm up 3 days, 5:15, 3 users, load average: 0.44, 0.58, 0.61
53 processes: 51 sleeping, 2 running, 0 zombie, 0 stopped

CPU states:  7.5% user, 17.6% system,  0.0% nice, 74.7% idle
Mem:   770844K av,  767476K used,    3368K free,     824K shrd,   80280K buff
Swap:       0K av,       0K used,       0K free                  134424K cached

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
1076 squid 16 0 499M 499M 2108 R 23.0 66.3 2546m squid

Quoted 6 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 8 lines
-------------------------------------------------------------------------- 
Joel Jaeggli				       [email protected]    
Academic User Services			     [email protected]
     PGP Key Fingerprint: 1DE9 8FCA 51FB 4195 B42A 9C32 A30D 121E
--------------------------------------------------------------------------
It is clear that the arm of criticism cannot replace the criticism of
arms.  Karl Marx -- Introduction to the critique of Hegel's Philosophy of
the right, 1843.
author
#2 lore raw

Yes, I have.

I have 1024MB of ram.

When running every X application I have as user + root + etc, I still only use 600MB out of the 1024MB of ram.

#3 lore raw
In reply to war
Quoted 1 line

How can having swap speed ANYTHING up?

simple: under memory load, it's more efficient to scavenge idle pages so they can be used for some "hotter" purpose. there usually are *some* pages in any process which are only used at startup, or very rarely used. if there's no memory pressure, sure, leave them there. if there is some other use for the memory, even caching files, then it's more efficient to swap those pages (assuming they're dirty).

swap is a sound way of making more efficient use of limited ram.

Quoted 2 lines

RAM = 1000MB/s.
DISK = 10MB/s

well, modern disks are 40 MB/s, and a typical non-rambus PC has only around 600 MB/s dram bandwidth, depending on how you measure it, etc.

Quoted 1 line

Ram is generally 1000x faster than a hard disk.

no, more like 20x; it can be up to around 80x (1.6 GB/s pc800 and a fairly pathetic 20 MB/s disk). the *latency* ratio can be much higher (10 ms vs 200 ns).

Quoted 1 line

No swap = fastest possible solution.

false in general. the only case where this is true is where you either have just the right amount of ram (unlikely, unless you can tune your apps rather carefully), or you have too much (your case).

#4 lore raw
In reply to war

Its not so much that Swap speeds anything up, its that it allows the machine process things more efficently because it can do more at once.

Quoted 17 lines · war

I do not understand something.

How can having swap speed ANYTHING up?

RAM = 1000MB/s.
DISK = 10MB/s

Ram is generally 1000x faster than a hard disk.

No swap = fastest possible solution.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#6 lore raw
In reply to war

Yeah, but when the disk starts swapping the system slows down to a halt.

Quoted 21 lines · H. Peter Anvin
Followup to:  <[email protected]>
By author:    war <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 5 lines

I do not understand something.

How can having swap speed ANYTHING up?

By allowing RAM to be better utilized.

-hpa
--
<[email protected]> at work, <[email protected]> in private!
"Unix gives you enough rope to shoot yourself in the foot."
http://www.zytor.com/~hpa/puzzle.txt <[email protected]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#7 lore raw
In reply to war
Quoted 2 lines · war

Yeah, but when the disk starts swapping the system slows down to a halt.

No, when the disk starts *THRASHING* the system slows down to a halt. If you are thrashing with swap you would be thrashing much worse without swap.

-hpa

#8 lore raw
In reply to war
Quoted 7 lines · war

I do not understand something.
How can having swap speed ANYTHING up?

RAM = 1000MB/s.
DISK = 10MB/s

Ram is generally 1000x faster than a hard disk.

This also means that the the caching of files from your filesystem (say, /usr/bin/netscape or /lib/libc.so) is 1000x faster than reading them from disk.

Quoted 1 line

No swap = fastest possible solution.

Not true if having no swap means you do not have enough memory to cache /lib/libc.so ;)

regards,

Rik

Signature · 3 lines
Shortwave goes a long way:  irc.starchat.net  #swl

http://www.surriel.com/		http://distro.conectiva.com/
#9 lore raw
In reply to war
Quoted 4 lines
Quoted 1 line

Yeah, but when the disk starts swapping the system slows down to a halt.

No, when the disk starts *THRASHING* the system slows down to a halt. If you are thrashing with swap you would be thrashing much worse without swap.

Not neccessarily.
Your swap early swap often paradigma works fine...as long as the swap partition resides on an standalone harddisk without a data partition.

But imagine the situation that you have a higher band width streaming application - e.g. viewing a video file. On the same hard disc there is a swap partition. Cache is getting bigger and bigger until kernel starts to swap.
Now the swapping algorithm writes on the harddisc. That troubles the hard disc elevation mechanism, so that higher bandwidth readings starve, due to head movements away from the data partitions towards the swap partition.

greetings

Christian Bornträger

#10 lore raw
In reply to war
Quoted 3 lines · war

I do not understand something.

How can having swap speed ANYTHING up?

By providing ADDITIONAL storage. Yes, it's slower than RAM - but it's faster than not having the storage at all.

Quoted 6 lines

RAM = 1000MB/s.
DISK = 10MB/s

Ram is generally 1000x faster than a hard disk.

No swap = fastest possible solution.

BS. You don't use swap INSTEAD of RAM, but AS WELL AS. Moving less frequently used data to swap allows you to put more frequently used data in RAM, which DOES speed things up. (At least, it does if the VM system works properly :P)

By your logic, we should switch off the system RAM, too: after all, L2 cache is much faster again, so using RAM can only slow things down?

James.

author
#11 lore raw
In reply to war

Incorrect, my point is I have enough ram where I am not going to run out for the things I do.

Using swap simply slows the system down!

Quoted 28 lines · James A Sutherland
Quoted 3 lines · war

I do not understand something.

How can having swap speed ANYTHING up?

By providing ADDITIONAL storage. Yes, it's slower than RAM - but it's faster than not having the storage at all.

Quoted 6 lines

RAM = 1000MB/s.
DISK = 10MB/s

Ram is generally 1000x faster than a hard disk.

No swap = fastest possible solution.

BS. You don't use swap INSTEAD of RAM, but AS WELL AS. Moving less frequently used data to swap allows you to put more frequently used data in RAM, which DOES speed things up. (At least, it does if the VM system works properly :P)

By your logic, we should switch off the system RAM, too: after all, L2 cache is much faster again, so using RAM can only slow things down?

James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#12 lore raw
In reply to war

Once again, I have enough ram where I am not going to run out for the things I do.
I never need swap.

When the system swaps, it slows down the system responsiveness big time.

Quoted 18 lines · Oliver Neukum

Am Donnerstag 22 November 2001 02:53 schrieb war:

Quoted 10 lines

I do not understand something.

How can having swap speed ANYTHING up?

RAM = 1000MB/s.
DISK = 10MB/s

Ram is generally 1000x faster than a hard disk.

No swap = fastest possible solution.

At some point you will run out of ram. Then you have to start paging. The only question there is whether you page only mmaped files including program code or whether you also write out program data.

HTH
Oliver

#13 lore raw
In reply to war
Quoted 2 lines · war

Incorrect, my point is I have enough ram where I am not going to run out for the things I do.

There's more to it than "not run out". You have some fixed amount of RAM; if the VM is working properly, adding swap will IMPROVE performance, because that fixed amount of RAM is used more efficiently.

Obviously, there are cases where removing swap breaks the system entirely, but even in other cases, adding swap should *never* degrade performance. (In theory, anyway; in practice, it still needs tuning...)

Quoted 1 line

Using swap simply slows the system down!

In which case, the VM isn't working properly; it SHOULD page out infrequently used data to make more room for caching frequently used files.

James.

#20 lore raw
In reply to war
Quoted 5 lines · war

Once again, I have enough ram where I am not going to run out for the things I do.
I never need swap.

When the system swaps, it slows down the system responsiveness big time.

"when it swaps" is meaningless: Linux ALWAYS swaps when there is swapspace. Do you mean when it *thrashes*? Or does your system have problems during I/O such as not using DMA for disk access?

James.

author
#22 lore raw
In reply to war

Why have SWAP if you don't need it - answer that.?

Quoted 23 lines · James A Sutherland
Quoted 3 lines · war

I do not understand something.

How can having swap speed ANYTHING up?

By providing ADDITIONAL storage. Yes, it's slower than RAM - but it's faster than not having the storage at all.

Quoted 6 lines

RAM = 1000MB/s.
DISK = 10MB/s

Ram is generally 1000x faster than a hard disk.

No swap = fastest possible solution.

BS. You don't use swap INSTEAD of RAM, but AS WELL AS. Moving less frequently used data to swap allows you to put more frequently used data in RAM, which DOES speed things up. (At least, it does if the VM system works properly :P)

By your logic, we should switch off the system RAM, too: after all, L2 cache is much faster again, so using RAM can only slow things down?

James.

#23 lore raw
In reply to war
Quoted 6 lines · war

Why have SWAP if you don't need it - answer that.?

Quoted 4 lines

BS. You don't use swap INSTEAD of RAM, but AS WELL AS. Moving less frequently used data to swap allows you to put more frequently used data in RAM, which DOES speed things up. (At least, it does if the VM system works properly :P)

Are you even reading what they're saying? Having swap lets you move less frequently used data to disk in favour of having more frequently used data in RAM.

Personally, I have more than enough RAM to run a fairly busy KDE2 desktop, and still have over 128megs in disk cache. And I still run with swap. The VM seems to find about 40megs of data I'm -simply not using-, and it now has the freedom to push that to swap so it can cache things that I -do use-. Although the more RAM you have, the less significant the results are, you'll find that in normal desktop/workstation/server use, the kernel will -always- find something to swap out to give itself more cache, and more cache is a very good thing. It's not fucking rocket science.

-Ryan

author
#24 lore raw
In reply to war

The bottom line here is:

There is no need for swap if you have enough ram.
Using swap with more than enough ram does absolutley nothing for the system, except by degrading the performance of it.

Quoted 12 lines · James A Sutherland
Quoted 5 lines · war

Once again, I have enough ram where I am not going to run out for the things I do.
I never need swap.

When the system swaps, it slows down the system responsiveness big time.

"when it swaps" is meaningless: Linux ALWAYS swaps when there is swapspace. Do you mean when it *thrashes*? Or does your system have problems during I/O such as not using DMA for disk access?

James.

Quoted 2 lines · war

Incorrect, my point is I have enough ram where I am not going to run out for the things I do.

There's more to it than "not run out". You have some fixed amount of RAM; if the VM is working properly, adding swap will IMPROVE performance, because that fixed amount of RAM is used more efficiently.

Obviously, there are cases where removing swap breaks the system entirely, but even in other cases, adding swap should *never* degrade performance. (In theory, anyway; in practice, it still needs tuning...)

Quoted 1 line

Using swap simply slows the system down!

In which case, the VM isn't working properly; it SHOULD page out infrequently used data to make more room for caching frequently used files.

James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#14 lore raw
In reply to James A Sutherland
Quoted 8 lines · James A Sutherland
Quoted 2 lines · war

Incorrect, my point is I have enough ram where I am not going to run out for the things I do.

Obviously, there are cases where removing swap breaks the system entirely, but even in other cases, adding swap should *never* degrade performance. (In theory, anyway; in practice, it still needs tuning...)

Not quite true. The VM cannot look into the future, so if you have swap it could have just swapped out the application on the desktop you're about to switch to ;)

If you have more than enough swap, you can be sure that the program data will stay in ram and at most the executable code needs to be read in again from disk.

regards,

Rik

Signature · 3 lines
DMCA, SSSCA, W3C?  Who cares?  http://thefreeworld.net/

http://www.surriel.com/		http://distro.conectiva.com/
#28 lore raw
In reply to war
Quoted 1 line · war

Why have SWAP if you don't need it - answer that.?

Having it is supposed to improve performance. If you take two identical machines, and enable swap on one but not the other, the first machine should have better performance: it can cache the FS more effectively.

Now, if you have INSANE amounts of RAM (i.e. enough to have everything running in RAM *AND* every file you access cached) the swap will make no difference at all. Under any other circumstances, it should make things better.

James.

#29 lore raw
In reply to war
Quoted 5 lines · war

The bottom line here is:

There is no need for swap if you have enough ram.
Using swap with more than enough ram does absolutley nothing for the system, except by degrading the performance of it.

If the system has so much RAM that EVERYTHING fits in RAM - programs, data and FS cache - then the swap won't be touched anyway, and makes no difference. This is rather unlikely on a PC; in practice, adding swap should always improve matters. (Of course, the VM isn't perfect yet...)

James.

#27 lore raw
In reply to war
Quoted 3 lines · war

There is no need for swap if you have enough ram.
Using swap with more than enough ram does absolutley nothing for the system, except by degrading the performance of it.

You're too fast with drawing conclusions. You say you have "enough" ram - tell me, how big is your harddisk ? Is it less than 1 GB ? Do you use more than 1 GB of data on your harddisk regularly ?

RAM is not just used to keep your programs in, but also to hold a working copy of your dataset on the hard-disk. If the programs you use concurrently use 500 MB RAM and never more, and you have 1 GB RAM, you have 500 MB over for caching your hard disk content. As long as you only access a footprint of 500 MB on your disk, you're fine.

But as soon as you start accessing more data which in total will add up to more than that 1 GB RAM, there is the _potential_ for a swap to speed up access. There's absolutely nothing which say it _has_ to speed it up in a _particular_ case, but generally it can.

Also remember that a "swap" only swaps dirty pages. Your programs are run directly from the page-cache and can be flushed from that even if you have "disabled swap". The only thing that differs by adding swap is another freedom for the VM system to prioritize memory. Sometimes it does this badly, and you get upset, and sometimes it does it well.

/Bjorn

author
#30 lore raw
In reply to war

Thank you for understanding!

Quoted 18 lines · James A Sutherland
Quoted 1 line · war

Why have SWAP if you don't need it - answer that.?

Having it is supposed to improve performance. If you take two identical machines, and enable swap on one but not the other, the first machine should have better performance: it can cache the FS more effectively.

Now, if you have INSANE amounts of RAM (i.e. enough to have everything running in RAM *AND* every file you access cached) the swap will make no difference at all. Under any other circumstances, it should make things better.

James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author
#31 lore raw
In reply to war

This is incorrect.
SWAP is used on a [1GB ram/2GB swap system].

I talked to Rik about this.
He said generally SWAP is a good thing and increases performance.

However, in my case it does not.

Nov 22 12:18:41 <war> riel: For a single user system.
Nov 22 12:18:43 <ata> war: what are you trying to do ?
Nov 22 12:18:44 <riel>  war: it all depends on what you use the computer for
Nov 22 12:18:56 <riel>  war: that's a very important thing to specify ;)
Nov 22 12:18:57 <war> General X apps, staroffice/netscape/media
stuff(aviplay)/etc
Nov 22 12:19:06 <war> compiling apps once and awhile
Nov 22 12:19:13 <riel>  war: ok, in that case you omost likely don't need swap
Nov 22 12:19:32 <riel>  war: but you really _need_ to tell what you are using
the computer for before anybody can give a sensible answer ;)
Nov 22 12:19:43 <war> riel: thats what I thought too, yet people still say I do
even after I told them what I was using it for
Nov 22 12:19:52 <ata> learath: nope 1gb will still win just one app will loose
and die
Nov 22 12:19:54 <war> riel: I sent the list of my ps auxww (512 processes) and
I still had 350MB left over.
Nov 22 12:20:05 <riel>  war: yup, I saw that
Quoted 18 lines · James A Sutherland
Quoted 5 lines · war

The bottom line here is:

There is no need for swap if you have enough ram.
Using swap with more than enough ram does absolutley nothing for the system, except by degrading the performance of it.

If the system has so much RAM that EVERYTHING fits in RAM - programs, data and FS cache - then the swap won't be touched anyway, and makes no difference. This is rather unlikely on a PC; in practice, adding swap should always improve matters. (Of course, the VM isn't perfect yet...)

James.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#32 lore raw
In reply to war
Quoted 2 lines · war

This is incorrect.
SWAP is used on a [1GB ram/2GB swap system].

As it should be. Page out unused data to make room for more cache. This *should* improve performance overall. (Yes, latency suffers to boost throughput. A fairly common tradeoff; you'll be glad of it under heavier load...)

You have "enough" RAM in that the machine doesn't crash under load, but NOT enough that swap would go unused.

Quoted 4 lines

I talked to Rik about this.
He said generally SWAP is a good thing and increases performance.

However, in my case it does not.

As I've said, the VM doesn't always make the right choice :)

James.

#15 lore raw
In reply to Rik van Riel
Quoted 10 lines · Rik van Riel
Quoted 5 lines · James A Sutherland

Obviously, there are cases where removing swap breaks the system entirely, but even in other cases, adding swap should *never* degrade performance. (In theory, anyway; in practice, it still needs tuning...)

Not quite true. The VM cannot look into the future, so if you have swap it could have just swapped out the application on the desktop you're about to switch to ;)

I tend to agree. Especially since in some cases (i.e. after a long compilation (read : lots of code)), the VM has the most excellent idea to swap out all the GUI (X+apps) and everyone here knows how long it can be to restore the GUI in that case.

Obviously the problem is very much lessened, in my case, when i put the swap partition on the *other* drive than the root fs. Both are ATA100 (40GB 60GXPs), and the system is more responsive with swap on hdc while / in on hda, than both on hda.

François

#16 lore raw
In reply to Rik van Riel
Quoted 7 lines · François Cami
Quoted 6 lines · Rik van Riel
Quoted 4 lines · James A Sutherland

Obviously, there are cases where removing swap breaks the system entirely, but even in other cases, adding swap should *never* degrade performance. (In theory, anyway; in practice, it still needs tuning...)

Quoted 8 lines
Quoted 3 lines

Not quite true. The VM cannot look into the future, so if you have swap it could have just swapped out the application on the desktop you're about to switch to ;)

I tend to agree. Especially since in some cases (i.e. after a long compilation (read : lots of code)), the VM has the most excellent idea to swap out all the GUI (X+apps) and everyone here knows how long it can be to restore the GUI in that case.

Use-once should avoid *most* of that, though not all; all your .c files should be read in once each by gcc, and never touched again. Of course the headers need to be cached, and the .o files will be accessed multiple times too.

Quoted 4 lines

Obviously the problem is very much lessened, in my case, when i put the swap partition on the *other* drive than the root fs. Both are ATA100 (40GB 60GXPs), and the system is more responsive with swap on hdc while / in on hda, than both on hda.

Hmm... if you've experimented with this, how does this setup compare to a striped RAID of hda+hdc used for root and swap? (i.e. is the speedup down to splitting accesses between two spindles?)

James.

#17 lore raw
In reply to Rik van Riel
Quoted 7 lines · James A Sutherland
Quoted 5 lines

Obviously the problem is very much lessened, in my case, when i put the swap partition on the *other* drive than the root fs. Both are ATA100 (40GB 60GXPs), and the system is more responsive with swap on hdc while / in on hda, than both on hda.

Hmm... if you've experimented with this, how does this setup compare to a striped RAID of hda+hdc used for root and swap? (i.e. is the speedup down to splitting accesses between two spindles?)

I haven't, but it's a good idea, I may give it a try, but not very soon.

François

#18 lore raw
Quoted 7 lines · François Cami
Quoted 3 lines · James A Sutherland

Hmm... if you've experimented with this, how does this setup compare to a striped RAID of hda+hdc used for root and swap? (i.e. is the speedup down to splitting accesses between two spindles?)

I haven't, but it's a good idea, I may give it a try, but not very soon.

You shouldn't need striping for this--if you have two swap partitions with equal priority, the kernel will "stripe" them itself.

At least that's my understanding.

Sumner

#19 lore raw
Quoted 6 lines · G . Sumner Hayes
Quoted 5 lines · François Cami
Quoted 3 lines · James A Sutherland

Hmm... if you've experimented with this, how does this setup compare to a striped RAID of hda+hdc used for root and swap? (i.e. is the speedup down to splitting accesses between two spindles?)

Quoted 6 lines
Quoted 1 line

I haven't, but it's a good idea, I may give it a try, but not very soon.

You shouldn't need striping for this--if you have two swap partitions with equal priority, the kernel will "stripe" them itself.

At least that's my understanding.

It'll stripe the SWAP area, but not the root FS; what I'm interested in is how performance is affected by splitting both across two devices, compared to putting one on each.

James.

#26 lore raw
In reply to Thomas S. Iversen
Quoted 3 lines · Thomas S. Iversen
Quoted 1 line

There is no need for swap if you have enough ram.

Turn it off. How hard can that be?

That was my initial reaction too. I don't have near the memory he does and am very satisfied with VM throughput. I'm seeing some bad interactivity problems when loading my box while X/KDE is resident though.. things I don't see in shell land at all.

-Mike

#33 lore raw
In reply to war
Quoted 13 lines · James A Sutherland
Quoted 2 lines · war

Incorrect, my point is I have enough ram where I am not going to run out for the things I do.

There's more to it than "not run out". You have some fixed amount of RAM; if the VM is working properly, adding swap will IMPROVE performance, because that fixed amount of RAM is used more efficiently.

Obviously, there are cases where removing swap breaks the system entirely, but even in other cases, adding swap should *never* degrade performance. (In theory, anyway; in practice, it still needs tuning...)

Quoted 6 lines
Quoted 1 line

Using swap simply slows the system down!

In which case, the VM isn't working properly; it SHOULD page out infrequently used data to make more room for caching frequently used files.

James.

I disagree. It is true that a VM could be designed sufficiently complex that it would properly analyze every possible sequence of execution and have perfect prescience. It would probably take a few hundred gigabytes of table structure to do that and that in itself will slow down the VM just scanning those tables, I dare say.

In short, no VM is going to work perfectly -- it is extrapolating a model of behavior to a real world sequence of events and as such there will always be some real world set of programs and events that will make it worse than some other model of behavior (VM), including the one that never pages at all. We just want that to happen rarely (whatever that means).

A VM that is working properly is one that satisfies the beholder (sort of like beauty). And in fact, if you look at the various similar discussions on Microsoft newsgroups (sorry ;-), you may notice they don't seem to be able to come up with a mechanism that handles large uniform access working sets and still works well with "normal" (highly peaked) working sets. So I doubt it is an easy problem.

--Charles

#34 lore raw
In reply to war
Quoted 19 lines · Charles Marslett
Quoted 18 lines · James A Sutherland
Quoted 2 lines · war

Incorrect, my point is I have enough ram where I am not going to run out for the things I do.

There's more to it than "not run out". You have some fixed amount of RAM; if the VM is working properly, adding swap will IMPROVE performance, because that fixed amount of RAM is used more efficiently.

Obviously, there are cases where removing swap breaks the system entirely, but even in other cases, adding swap should *never* degrade performance. (In theory, anyway; in practice, it still needs tuning...)

Quoted 1 line

Using swap simply slows the system down!

In which case, the VM isn't working properly; it SHOULD page out infrequently used data to make more room for caching frequently used files.

Quoted 7 lines
Quoted 1 line

James.

I disagree. It is true that a VM could be designed sufficiently complex that it would properly analyze every possible sequence of execution and have perfect prescience. It would probably take a few hundred gigabytes of table structure to do that and that in itself will slow down the VM just scanning those tables, I dare say.

That wasn't quite what I had in mind :)

Quoted 5 lines

In short, no VM is going to work perfectly -- it is extrapolating a model of behavior to a real world sequence of events and as such there will always be some real world set of programs and events that will make it worse than some other model of behavior (VM), including the one that never pages at all. We just want that to happen rarely (whatever that means).

Yes, sometimes you'll get better behaviour in a specific case by "disabling" swap (i.e. forcing the kernel to page code instead), which in other cases causes nasty disk thrashing. In this case, though, I think the VM could do a much better job than it does presently; I've a feeling Rik's would perform better in this case, for example...

Quoted 6 lines

A VM that is working properly is one that satisfies the beholder (sort of like beauty). And in fact, if you look at the various similar discussions on Microsoft newsgroups (sorry ;-), you may notice they don't seem to be able to come up with a mechanism that handles large uniform access working sets and still works well with "normal" (highly peaked) working sets. So I doubt it is an easy problem.

Nobody said VM coding was easy - or that Microsoft had got it right :)

James.

#35 lore raw
In reply to war
Quoted 4 lines · James A Sutherland

Nobody said VM coding was easy - or that Microsoft had got it right :)

James.

Agreed, exactly what I meant to say,....

--Charles

#21 lore raw
In reply to James A Sutherland
Quoted 4 lines · On Thu, 22 Nov 2001 16:12:32 +0000 James A Sutherland <[email protected]> wrote:

"when it swaps" is meaningless: Linux ALWAYS swaps when there is swapspace. Do you mean when it *thrashes*? Or does your system have problems during I/O

such as not using DMA for disk access?

[17:03 athena] dang> free
total used free shared buffers cached
Mem: 255304 184416 70888 716 12636 77524
-/+ buffers/cache: 94256 161048
Swap: 128484 0 128484
[17:03 athena] dang> uname -a
Linux athena.fprintf.net 2.4.13-ac7-preempt-sse #1 Mon Nov 5 14:06:53 EST 2001 i686 unknown
[17:04 athena] dang>

Linux does not always swap.

Daniel

---
Recursion n.:
See Recursion.
-- Random Shack Data Processing Dictionary