* Re: dynamic allocation of swap disk space [not found] <fa.n6pggn5.84en31@ifi.uio.no> @ 2004-05-11 15:22 ` Ray Bryant 2004-05-11 15:52 ` John Bradford 2004-05-11 16:00 ` Oliver Neukum 0 siblings, 2 replies; 11+ messages in thread From: Ray Bryant @ 2004-05-11 15:22 UTC (permalink / raw) To: Silviu Marin-Caea; +Cc: linux-kernel Silviu Marin-Caea wrote: > > > My desktop has been thrashing the disk for a couple of hours because > the swap space was exhausted. And I have the ambition to leave it alone > to see if it ever comes out of the thrashing. Of course, it's not usable > at all during this time, I'm writing this on the laptop. > > You've got a couple problems mixed together here. (1) Swap space fills up because you have overcommitted memory. In principle, filling up swap space has nothing to do with "thrashing". (2) "thrashing" is a characteristic of a poorly performing program in a demand paging virtual memory system typically caused by trying to run a program with a resident size that is smaller than required. Systems can thrash without filling up swap space. It is true that systems can thrash AND fill up swap space, but it is not always so. You either need (1) more main memory, (2) reduce the number of programs you are running simultaneously, or (3) better behaving programs, or all three. Increasing the amount of swap space will just use more disk. It won't cause your system to stop thrashing since that is driven by what is going on in memory, not what is going on on the disk. Anyway, if swap space is full, then main memory is (nearly) full, and this is not a good time to do major surgery to your file system (e. g. increase the size of the swap space). You may not be able to allocate the required memory to complete that job and then your system will crash. > - > 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/ ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-11 15:22 ` dynamic allocation of swap disk space Ray Bryant @ 2004-05-11 15:52 ` John Bradford 2004-05-11 15:54 ` Valdis.Kletnieks ` (2 more replies) 2004-05-11 16:00 ` Oliver Neukum 1 sibling, 3 replies; 11+ messages in thread From: John Bradford @ 2004-05-11 15:52 UTC (permalink / raw) To: Ray Bryant, Silviu Marin-Caea; +Cc: linux-kernel Quote from Ray Bryant <raybry@sgi.com>: > > > Silviu Marin-Caea wrote: > > > > > > My desktop has been thrashing the disk for a couple of hours because > > the swap space was exhausted. And I have the ambition to leave it alone > > to see if it ever comes out of the thrashing. Of course, it's not usable > > at all during this time, I'm writing this on the laptop. > > > > > > You've got a couple problems mixed together here. > > (1) Swap space fills up because you have overcommitted memory. In principle, > filling up swap space has nothing to do with "thrashing". > (2) "thrashing" is a characteristic of a poorly performing program in a > demand paging virtual memory system typically caused by trying to run a > program with a resident size that is smaller than required. Systems can > thrash without filling up swap space. It is true that systems can thrash AND > fill up swap space, but it is not always so. > > You either need (1) more main memory, (2) reduce the number of programs you > are running simultaneously, or (3) better behaving programs, or all three. > Increasing the amount of swap space will just use more disk. It won't cause > your system to stop thrashing since that is driven by what is going on in > memory, not what is going on on the disk. Not necessarily. Increasing swap can allow more physical RAM to be used for caching data from disk. Imagine a system with limited physical RAM, and limited swap space, running a process which causes a lot of filesystem activity on the same physical disk as is being used for swap. If the total RAM, both physical and swap is almost completely full, increasing the swap space may allow some data from physical RAM to be swapped out, in favour of caching filesystem data from the disk. Without knowing more details of the original poster's machine, it's difficult to give specific advice about how to solve the problem. John. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-11 15:52 ` John Bradford @ 2004-05-11 15:54 ` Valdis.Kletnieks 2004-05-11 16:39 ` John Bradford 2004-05-11 16:28 ` Ray Bryant 2004-05-12 6:56 ` Silviu Marin-Caea 2 siblings, 1 reply; 11+ messages in thread From: Valdis.Kletnieks @ 2004-05-11 15:54 UTC (permalink / raw) To: John Bradford; +Cc: linux-kernel [-- Attachment #1: Type: text/plain, Size: 601 bytes --] On Tue, 11 May 2004 16:52:15 BST, John Bradford said: > Imagine a system with limited physical RAM, and limited swap space, running a > process which causes a lot of filesystem activity on the same physical disk > as is being used for swap. If the total RAM, both physical and swap is almost > completely full, increasing the swap space may allow some data from physical > RAM to be swapped out, in favour of caching filesystem data from the disk. Possible, but wouldn't that imply that the value of /proc/sys/vm/swappiness is very mis-set and causing a too-high estimate of the working set size? [-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-11 15:54 ` Valdis.Kletnieks @ 2004-05-11 16:39 ` John Bradford 0 siblings, 0 replies; 11+ messages in thread From: John Bradford @ 2004-05-11 16:39 UTC (permalink / raw) To: Valdis.Kletnieks; +Cc: linux-kernel Quote from Valdis.Kletnieks@vt.edu: > > On Tue, 11 May 2004 16:52:15 BST, John Bradford said: > > > Imagine a system with limited physical RAM, and limited swap space, running a > > process which causes a lot of filesystem activity on the same physical disk > > as is being used for swap. If the total RAM, both physical and swap is almost > > completely full, increasing the swap space may allow some data from physical > > RAM to be swapped out, in favour of caching filesystem data from the disk. > > Possible, but wouldn't that imply that the value of /proc/sys/vm/swappiness > is very mis-set and causing a too-high estimate of the working set size? Yes - to be honest, I was thinking of very low spec systems, where swap may well be less than or equal to physical RAM size. John. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-11 15:52 ` John Bradford 2004-05-11 15:54 ` Valdis.Kletnieks @ 2004-05-11 16:28 ` Ray Bryant 2004-05-12 6:56 ` Silviu Marin-Caea 2 siblings, 0 replies; 11+ messages in thread From: Ray Bryant @ 2004-05-11 16:28 UTC (permalink / raw) To: John Bradford; +Cc: Silviu Marin-Caea, linux-kernel Hi John, John Bradford wrote: > > > Not necessarily. Increasing swap can allow more physical RAM to be used for > caching data from disk. > > Imagine a system with limited physical RAM, and limited swap space, running a > process which causes a lot of filesystem activity on the same physical disk > as is being used for swap. If the total RAM, both physical and swap is almost > completely full, increasing the swap space may allow some data from physical > RAM to be swapped out, in favour of caching filesystem data from the disk. Hmmm... Lets see, we have a program (or set of programs) in memory that is thrashing, i. e. it is page faulting at a rate that is higher than the vm system can supply pages, so it is spending its time waiting for pages and the disk subsystem is busy. Now, if we increase the amount of data cached from disk, without increasing main memory, we've decreased the amount of memory available to the thrashing program, perhaps making its problems worse? Well, I guess all this shows is that with the vm subsystem, speculation is often useless, one has to fire up the box with a carefully constructed workload and see what happens. > > Without knowing more details of the original poster's machine, it's difficult > to give specific advice about how to solve the problem. > I certainly agree with that. Time for this thread to die, I think. :-) Cheers. > John. > -- Best Regards, Ray ----------------------------------------------- Ray Bryant 512-453-9679 (work) 512-507-7807 (cell) raybry@sgi.com raybry@austin.rr.com The box said: "Requires Windows 98 or better", so I installed Linux. ----------------------------------------------- ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-11 15:52 ` John Bradford 2004-05-11 15:54 ` Valdis.Kletnieks 2004-05-11 16:28 ` Ray Bryant @ 2004-05-12 6:56 ` Silviu Marin-Caea 2 siblings, 0 replies; 11+ messages in thread From: Silviu Marin-Caea @ 2004-05-12 6:56 UTC (permalink / raw) To: John Bradford; +Cc: Ray Bryant, linux-kernel John Bradford wrote: > Quote from Ray Bryant <raybry@sgi.com>: > >> >>Silviu Marin-Caea wrote: >> >>> >>>My desktop has been thrashing the disk for a couple of hours because >>>the swap space was exhausted. And I have the ambition to leave it alone >>>to see if it ever comes out of the thrashing. Of course, it's not usable >>>at all during this time, I'm writing this on the laptop. >>> >>> >> >>You've got a couple problems mixed together here. >> >>(1) Swap space fills up because you have overcommitted memory. In principle, >>filling up swap space has nothing to do with "thrashing". >>(2) "thrashing" is a characteristic of a poorly performing program in a >>demand paging virtual memory system typically caused by trying to run a >>program with a resident size that is smaller than required. Systems can >>thrash without filling up swap space. It is true that systems can thrash AND >>fill up swap space, but it is not always so. >> >>You either need (1) more main memory, (2) reduce the number of programs you >>are running simultaneously, or (3) better behaving programs, or all three. >>Increasing the amount of swap space will just use more disk. It won't cause >>your system to stop thrashing since that is driven by what is going on in >>memory, not what is going on on the disk. > > > Not necessarily. Increasing swap can allow more physical RAM to be used for > caching data from disk. > > Imagine a system with limited physical RAM, and limited swap space, running a > process which causes a lot of filesystem activity on the same physical disk > as is being used for swap. If the total RAM, both physical and swap is almost > completely full, increasing the swap space may allow some data from physical > RAM to be swapped out, in favour of caching filesystem data from the disk. > > Without knowing more details of the original poster's machine, it's difficult > to give specific advice about how to solve the problem. 1 GB RAM desktop machine, with 32 MB swap, kernel 2.6.3. In normal operation, the swap is 80% free. It started the thrashing when I loaded a HUGE page (generated from a database) in konqueror. The issue is not to solve _my_ problem, I really don't care about it that much, the issue would be to solve this sort of problem for everyone. I've had disk thrashing with filled up swap on a server (kernel 2.4) and that was much worse. Anyway, I'll start using swapd and see what happens. Some time in the future, I'll post here the conclusion. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-11 15:22 ` dynamic allocation of swap disk space Ray Bryant 2004-05-11 15:52 ` John Bradford @ 2004-05-11 16:00 ` Oliver Neukum 1 sibling, 0 replies; 11+ messages in thread From: Oliver Neukum @ 2004-05-11 16:00 UTC (permalink / raw) To: Ray Bryant; +Cc: Silviu Marin-Caea, linux-kernel > thrash without filling up swap space. It is true that systems can thrash AND > fill up swap space, but it is not always so. However the system will also thrash if you have inactive dirty pages without file backing taking up to much main memory. Albeit it is more a theoretical possibilty. Regards Oliver ^ permalink raw reply [flat|nested] 11+ messages in thread
* dynamic allocation of swap disk space @ 2004-05-10 8:50 Silviu Marin-Caea 2004-05-10 10:03 ` John Bradford 0 siblings, 1 reply; 11+ messages in thread From: Silviu Marin-Caea @ 2004-05-10 8:50 UTC (permalink / raw) To: linux-kernel It's the same old whine. Please include http://sourceforge.net/projects/swapd/ or http://sourceforge.net/projects/dynswapd/ or whatever in the official kernel. My desktop has been thrashing the disk for a couple of hours because the swap space was exhausted. And I have the ambition to leave it alone to see if it ever comes out of the thrashing. Of course, it's not usable at all during this time, I'm writing this on the laptop. This is the only serious bug (I consider it a bug) in the linux kernel that I encountered on occasions. And it was not fixed in 2.6. Forgot to mention, my desktop is running 2.6.3. The way I see the solution is: allocate swap space dynamically, until there is no need for more or the disk becomes nearly full. If that happens, then start thrashing it, all right. Then when the condition is gone and things are back to normal deallocate the additional swap. Old whine or not, it's a real problem. Thanks. PS: I'm not subscribed. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-10 8:50 Silviu Marin-Caea @ 2004-05-10 10:03 ` John Bradford 2004-05-10 10:22 ` Silviu Marin-Caea 0 siblings, 1 reply; 11+ messages in thread From: John Bradford @ 2004-05-10 10:03 UTC (permalink / raw) To: Silviu Marin-Caea, linux-kernel Hi, Quote from "Silviu Marin-Caea" <silviu@genesys.ro>: > The way I see the solution is: allocate swap space dynamically, until > there is no need for more or the disk becomes nearly full. If that > happens, then start thrashing it, all right. Then when the condition is > gone and things are back to normal deallocate the additional swap. Very bad idea in my opinion. Over allocating swap space is a BAD practice, but the effects are usually not as apparent as under allocating swap space, and such a system works most of the time, albeit often not as efficiently as it could do. The solution is to allocate the correct amount of swap space. How much is that? There is not really a simple answer, and it's certainly not as simple as twice the physical RAM. A run-away process on a server with too much swap may well cause the machine to become very unresponsive, whereas if the amount of virtual memory available had been little more than what was expected to be required, the run-away process would have terminated, allowing the problem to be fixed with minimal disruption to other services. John. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-10 10:03 ` John Bradford @ 2004-05-10 10:22 ` Silviu Marin-Caea 2004-05-10 20:28 ` Paul Jackson 0 siblings, 1 reply; 11+ messages in thread From: Silviu Marin-Caea @ 2004-05-10 10:22 UTC (permalink / raw) Cc: linux-kernel John Bradford wrote: >>The way I see the solution is: allocate swap space dynamically, until >>there is no need for more or the disk becomes nearly full. If that >>happens, then start thrashing it, all right. Then when the condition is >>gone and things are back to normal deallocate the additional swap. > > > Very bad idea in my opinion. Most likely quite so, I'm not a guru yet :-) > Over allocating swap space is a BAD practice, but the effects are usually not How about dynamically allocating up to a certain limit. Say, you have 256 MB or even less (to save space), and you allocate when needed up to 1 GB, then stop allocating, thrash disk, let the kernel detect and kill the runaway process. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: dynamic allocation of swap disk space 2004-05-10 10:22 ` Silviu Marin-Caea @ 2004-05-10 20:28 ` Paul Jackson 0 siblings, 0 replies; 11+ messages in thread From: Paul Jackson @ 2004-05-10 20:28 UTC (permalink / raw) To: Silviu Marin-Caea; +Cc: linux-kernel, John Bradford > How about dynamically allocating up to a certain limit. Given that disk space is essentially "free", how does that differ from simply allocating swap files up to the desired limit size? And having a bigger swap space wouldn't help your thrashing problem. You're not thrashing (unusable system, mucho disk activity) for lack of swap space. You're thrashing because you are trying to use the swap space you already have for active pages. -- I won't rest till it's the best ... Programmer, Linux Scalability Paul Jackson <pj@sgi.com> 1.650.933.1373 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2004-05-12 6:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <fa.n6pggn5.84en31@ifi.uio.no>
2004-05-11 15:22 ` dynamic allocation of swap disk space Ray Bryant
2004-05-11 15:52 ` John Bradford
2004-05-11 15:54 ` Valdis.Kletnieks
2004-05-11 16:39 ` John Bradford
2004-05-11 16:28 ` Ray Bryant
2004-05-12 6:56 ` Silviu Marin-Caea
2004-05-11 16:00 ` Oliver Neukum
2004-05-10 8:50 Silviu Marin-Caea
2004-05-10 10:03 ` John Bradford
2004-05-10 10:22 ` Silviu Marin-Caea
2004-05-10 20:28 ` Paul Jackson
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.