Gentoo Archives: gentoo-user

From: "Fatih Tümen" <fthtmn+gentoo@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] swap usage creeping up
Date: Tue, 26 Oct 2010 06:32:06
Message-Id: AANLkTinpCrpc6O+FECTWs_7AcXBCQ17Y0LGeZtM3ihm=@mail.gmail.com
In Reply to: [gentoo-user] swap usage creeping up by Iain Buchanan
1 On Tue, Oct 26, 2010 at 8:49 AM, Iain Buchanan <iaindb@××××××××××××.au> wrote:
2 > Hi,
3 >
4 > over the last week or so I've noticed unusually large swap usage.  I
5 > usually hibernate this laptop and have uptimes up to 12 days so apps can
6 > run for a long time.  I don't usually use any swap space (except for a
7 > few k).
8 >
9 > If I swapoff and swapon, the usage falls back to zero but then creeps up
10 > again over a few days.
11 >
12 > $ free -m
13 >             total       used       free     shared    buffers     cached
14 > Mem:          3040        859       2181          0         38        415
15 > -/+ buffers/cache:        406       2634
16 > Swap:          494        431         62
17 >
18
19 Looking at above values 494MB does not seem to be enough for
20 hibernation. Do you add extra swap or close some apps before
21 hibernation?
22
23 If your system trying to fill up your swap while you have more than
24 2GB of main memory available, only thing I can think of is your
25 swapiness is set very high. You check and alter is as follows
26
27 $ cat /proc/sys/vm/swappiness
28 and
29 # echo N > /proc/sys/vm/swappiness
30
31 where N is a value between 0 and 100. Higher number means more
32 swapping. If I had 3GB of ram I would set it to something closer to 0
33 or even 0 if I am just gonna use it for hibernation.
34
35 > nothing unusual there, except for the swap usage itself.  'top' doesn't
36 > show any large apps.  sorted by mem the top 4 are:
37 >  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
38 >  8318 iain      20   0  494m 150m  21m S    0  5.0   1:20.67 evolution
39 > 20424 iain      20   0  342m  77m  30m S    0  2.5   0:01.84 firefox
40 >  8009 root      20   0 83364  37m 6260 S    7  1.2  38:34.31 X
41 >  8090 iain      20   0  159m  32m 1600 S    1  1.1   3:48.08 skype
42 >
43 > Hm, I just noticed Mem is in %.  % of what?  % total or % used?  Even if
44 > it was % of total RAM that could be as much as 152Mb for evo and 76Mb
45 > for firefox.  Not that much really.
46 >
47
48 % of total main memory excluding swap because its rather difficult to
49 take it into account.
50 3040*0.05 = 152 evolution
51
52
53 > any ideas?
54 >
55
56 You can try to view swap usage on top by pressing f then p and enter
57 and sort by it by F then P and enter. The values wont be very
58 realistic though. Alternatively you could try is to compare resident
59 memory usages before and after swapoff.
60
61 Given the mem usage of your apps, total mem usage looks normal. What
62 does not seem normal is that swap inclined mem usage. Seriously take a
63 look at your swapiness value. The default value cannot be right every
64 particular case.
65
66
67 > thanks :)
68 > --
69 > Iain Buchanan <iaindb at netspace dot net dot au>
70 >
71 > Chuck Norris once skewered a man with the Eiffel tower.
72 >
73 >
74 >
75
76
77 --
78    Fatih

Replies

Subject Author
Re: [gentoo-user] swap usage creeping up Iain Buchanan <iaindb@××××××××××××.au>