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
1 On Sat, 31 Jul 2004 09:57:47 -0600, Gyujin Park <gpark@××××××.com> wrote:
2 > Thanks. Yes, I will definitely go for a search on this on other lists too.
3 >
4 > The command line you gave me actually made my memory free. It's kind of
5 > interesting. You said it would freeze, but it actually cleared my memory.
6 >
7 > So I did
8 > dd if=/dev/hda1 of=/dev/null bs=400M
9 >
10 > and the result was
11 > 0+1 records in
12 > 0+1 records out
13 >
14 > and I did
15 > free
16 > and suddenly 116MB Free Memory space. :O
17 >
18 > total used free shared buffers cached
19 > Mem: 514688 397888 116800 0 11132 251636
20 > -/+ buffers/cache: 135120 379568
21 > Swap: 2008116 0 2008116
22
23 It didn't freeze or turn to swap (which has still not been disproven
24 to work) probably because 400MB is coincidentally the amount of memory
25 you *can* allocate without, in addition to your running programs,
26 cross 512MB. You probably flushed the cache-and-buffers down to 25
27 megs as your other 'free' output displayed.
28
29 If you ran free earlier than you just did, you probably would have
30 seen a lot more on the figure as free - but again, the realistical
31 figure is now 379568, which as you may noticed has changed very little
32 from your earlier outputs.
33 The memory used by your programs alone is around 514M-379M = 135M in
34 that output. The rest is either in cache and buffers, or NOT in cache
35 and buffers right after you did a dd.
36
37 > Yes, I know system goes slow when it runs into swap since HDD aren't that fast
38 > enough re-write speed as Memory.
39 You want to avoid it. Always. It loads your entire system and bugs its
40 speed down to a fraction of its possibly throughput.
41
42 > I agree, systems in both linux and windows aren't very optimized at using SWAP.
43 > Macs have problems also. Although, the big problem is *not turning into swap!!*
44 >
45 > May be this is an issue with 2004.2 Stage 3 installation. I am currently using
46 > Gentoo 2004.0 (since 2004.1 had pour support for eth0 cards.) for my desktop, and
47 > it runs into swap fine.
48
49 Like I said, I have seen no evidence to suggest swap isn't working as
50 it should. Your memory requirements - when you consider the real
51 meanings of free-at-all and free-not-counting-cache-and-buffers, and
52 the flexibility of said cache, it seems to me you never actually made
53 your comptuer use all your memory, and then it becomes a very good
54 thing that it doesn't turn to swap.
55
56 Actually, it might have swapped a little after the dd with a 400mb
57 allocation, but decided to swap right back in when it saw memory was
58 free. Possibly the fact you're allocating 400mb on a system that has
59 380MB free not counting cache doesn't make it swap; maybe memory is
60 more flexible with a relatively small figure like 20mb than I thought.
61
62 A sure yet dangerous test, as I suggested, is to use dd with a figure
63 larger than yor physical memory or possibly free memory- 500 would be
64 fine; a runnins system needs more than the 12mb that leaves for it.
65 600 would be a sure test, but again - *if* it swaps it'll become slow,
66 if it doesn't it'll probably crash, elegantly or not.
67
68
69
70 But basically, I think you have none of the problems you thougt you had.
71
72 --Bart
73
74 --
75 gentoo-performance@g.o mailing list