Gentoo Archives: gentoo-performance

From: Bart Alewijnse <scarfboy@×××××.com>
To: gentoo-performance@l.g.o
Subject: Re: [gentoo-performance] swap?
Date: Sat, 31 Jul 2004 17:16:39
Message-Id: b71082d80407311016600653cb@mail.gmail.com
On Sat, 31 Jul 2004 09:57:47 -0600, Gyujin Park <gpark@××××××.com> wrote:
> Thanks. Yes, I will definitely go for a search on this on other lists too. > > The command line you gave me actually made my memory free. It's kind of > interesting. You said it would freeze, but it actually cleared my memory. > > So I did > dd if=/dev/hda1 of=/dev/null bs=400M > > and the result was > 0+1 records in > 0+1 records out > > and I did > free > and suddenly 116MB Free Memory space. :O > > total used free shared buffers cached > Mem: 514688 397888 116800 0 11132 251636 > -/+ buffers/cache: 135120 379568 > Swap: 2008116 0 2008116
It didn't freeze or turn to swap (which has still not been disproven to work) probably because 400MB is coincidentally the amount of memory you *can* allocate without, in addition to your running programs, cross 512MB. You probably flushed the cache-and-buffers down to 25 megs as your other 'free' output displayed. If you ran free earlier than you just did, you probably would have seen a lot more on the figure as free - but again, the realistical figure is now 379568, which as you may noticed has changed very little from your earlier outputs. The memory used by your programs alone is around 514M-379M = 135M in that output. The rest is either in cache and buffers, or NOT in cache and buffers right after you did a dd.
> Yes, I know system goes slow when it runs into swap since HDD aren't that fast > enough re-write speed as Memory.
You want to avoid it. Always. It loads your entire system and bugs its speed down to a fraction of its possibly throughput.
> I agree, systems in both linux and windows aren't very optimized at using SWAP. > Macs have problems also. Although, the big problem is *not turning into swap!!* > > May be this is an issue with 2004.2 Stage 3 installation. I am currently using > Gentoo 2004.0 (since 2004.1 had pour support for eth0 cards.) for my desktop, and > it runs into swap fine.
Like I said, I have seen no evidence to suggest swap isn't working as it should. Your memory requirements - when you consider the real meanings of free-at-all and free-not-counting-cache-and-buffers, and the flexibility of said cache, it seems to me you never actually made your comptuer use all your memory, and then it becomes a very good thing that it doesn't turn to swap. Actually, it might have swapped a little after the dd with a 400mb allocation, but decided to swap right back in when it saw memory was free. Possibly the fact you're allocating 400mb on a system that has 380MB free not counting cache doesn't make it swap; maybe memory is more flexible with a relatively small figure like 20mb than I thought. A sure yet dangerous test, as I suggested, is to use dd with a figure larger than yor physical memory or possibly free memory- 500 would be fine; a runnins system needs more than the 12mb that leaves for it. 600 would be a sure test, but again - *if* it swaps it'll become slow, if it doesn't it'll probably crash, elegantly or not. But basically, I think you have none of the problems you thougt you had. --Bart -- gentoo-performance@g.o mailing list