ã€€In the course of discussion, it became clear that Linux 2.4.x required more swap than previous versions. Rik van Riel mentioned, â€œ2.4 keeps dirty pages in the swap cache, so you will need more swap to run the same programsâ€¦â€ He asked Linus Torvalds, â€œis this something we want to keep or should we give the user the option to run in a mode where swap space is freed when we swap in something non-shared ?â€ Linus replied:
ã€€ã€€Iâ€™d prefer just documenting it and keeping it. Iâ€™d hate to have two fairly different modes of behaviour. Itâ€™s always been the suggested â€œtwice the amount of RAMâ€, although thereâ€™s historically been the â€œLinux doesnâ€™t really need that muchâ€ that we just killed with 2.4.x.
ã€€ã€€If you have 512MB of RAM, you can probably afford another 40GB or so of harddisk. They are disgustingly cheap these days.
ã€€ã€€Zlatko Calusic worried that more data in swap would degrade performance because the disk head would need more seek time to find data. He asked if Linus was sure this would be okay, and Linus replied, â€œIâ€™m not _sure_, obviously. However, one thing I _am_ sure of is that the sticky page-cache simplifies some things enormously, and make some things possible that simply werenâ€™t possible before.â€ . But in a nearby post he admitted, â€œthe sticky allocation _might_ make the IO we do be more spread out.â€ He felt it was important to consider these kinds of potential downsides, though he felt that in this case the benefits outweighed the drawbacks; and at one point Eric W. Biederman explained succinctly, â€œThe tradeoff when implemented correctly is that writes will tend to be more spread out and reads should be better clustered together.â€
ã€€ã€€Zlatko ran some tests, and could not find any problems with the 2.4.0 memory management logic, though he added, â€œI have found that new kernel allocates 4 times more swap space under some circumstances. That may or may not be alarming, it remains to be seen.â€ At one point, Linus gave his overall take on 2.2/2.4 performance issues. He said:
ã€€ã€€I personally think 2.4.x is going to be as fast or faster at just about anything. We do have some MM issues still to hash out, and tuning to do, but Iâ€™m absolutely convinced that 2.4.x is going to be a _lot_ easier to tune than 2.2.x ever was. The â€œscan the page tables without doing any IOâ€ thing just makes the 2.4.x memory management several orders of magnitude more flexible than 2.2.x ever was.
ã€€ã€€(This is why I worked so hard at getting the PageDirty semantics right in the last two months or so – and why I released 2.4.0 when I did. Getting PageDirty right was the big step to make all of the VM stuff possible in the first place. Even if it probably looked a bit foolhardy to change the semantics of â€œwritepage()â€ quite radically just before 2.4 was released).
ã€€ã€€Elsewhere, he considered the case of swapless or low-swap machines:
ã€€ã€€If you donâ€™t have any swap, or if you run out of swap, the major difference between 2.2.x and 2.4.x is probably going to be the oom handling: I suspect that 2.4.x might be more likely to kill things off sooner (but it tries to be graceful about which processes to kill).
ã€€ã€€Not having any swap is going to be a performance issue for both 2.2.x and 2.4.x – Linux likes to push inactive dirty pages out to swap where they can lie around without bothering anybody, even if there is no _major_ memory crunch going on.
ã€€ã€€If you do have swap, but itâ€™s smaller than your available physical RAM, I suspect that the Linux-2.4 swap pre-allocate may cause that kind of performance degradation earlier than 2.2.x would have. Another way of putting this: in 2.2.x you could use a fairly small swap partition to pick up some of the slack, and in 2.4.x a really small swap-partition doesnâ€™t really buy you much anything.