Gentoo Archives: gentoo-user

From: Alex Schuster <wonko@×××××××××.org>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Swap performance
Date: Wed, 25 May 2011 14:24:22
Message-Id: 201105251621.00659.wonko@wonkology.org
1 Hi there!
2
3 I still wonder why my KDE4 system starts swapping so early. Until a week
4 ago, I had 6G of RAM, but after a day of being logged in, I usually had some
5 swap usage. Sometimes this goes up to 1.5G, this is when the system becomes
6 way too slow and I log out.
7
8 Normally I don't mind having swap, I always had. But to me it looks like
9 this is worse than it should be. From the point when swapping starts, it's
10 nearly permanent, like, when switching applications and desktops. As if
11 important stuff were swapped out that will be needed again soon. While
12 unimportant stuff stays in memory.
13
14 This was even worse when using the ati-drivers/fglrx, but at the moment
15 I'm using xf86-video-ati with xorg-server-1.10.1.901 and KMS.
16 echo 1 > /proc/sys/vm/drop_caches helps a little, but not much. And not
17 for long.
18
19 Sometimes I quit memory-hungry applications like Kontact, Amarok and TV
20 Browser and restart them immediately afterwards. Memory usage has
21 dropped, and desktop switching is fast again, once I went to every desktop
22 so that stuff will be swapped in. BTW, vm.swappiness is set to 20.
23
24 Or I do a 'swapoff -a && swapon -a', this empties the swap and also
25 frees memory. But this takes _quite_ _a_ _while_. Once I measured 37 minutes
26 to clear 1G of swap.
27 But I do not remember how much memory was being used then, so I tried
28 again, after closing memory-intensive applications:
29
30 weird ~ # free -m
31 total used free shared buffers cached
32 Mem: 5721 4184 1536 0 34 111
33 -/+ buffers/cache: 4039 1682
34 Swap: 4093 885 3208
35
36 weird ~ # time swapoff -a
37
38 real 27m8.757s
39 user 2m12.284s
40 sys 21m37.089s
41
42 weird ~ # free -m
43 total used free shared buffers cached
44 Mem: 5721 4785 936 0 53 409
45 -/+ buffers/cache: 4322 1398
46 Swap: 0 0 0
47
48 So, 27 minutes to put 885MB of swap back into RAM, with the double amount of
49 that being free RAM. I monitored with iotop, and the transfer rate started
50 around 60-100 K/s, later it went higher. But the average transfer rate is
51 550K/s. Shouldn't swap be, like, a little faster?
52
53 My swap is on an LUKS-encrypted LVM volume, but I tried with a fresh new
54 LVM volume, and it was a little better only. The SATA drive gives 80-100
55 MB/s according to hdparm -t. dd'ing /dev/zero directly to the swap volume
56 gives around 100 MB/s.
57
58 I'm running ck-sources 2.6.38, but I experience this for a long time
59 now, and changed from tuxonice-sources (another thing that just doesn't
60 work well for me) to ck-sources, to try if this would improve things. I
61 even cloned a .config from some live cd, in case I had some stupid option
62 activated that slowed things down.
63
64 Lowering swappiness helped, as did more memory. With 3.7G of RAM, KDE4
65 was barely usable. But two years ago, when this PC was new, I ran KDE 4.2 on
66 x86, compiled all except OpenOffice in tmpfs, often had a virtual
67 machine running in VMplayer, and it was fine.
68
69 I sure run lots of applications (Kontact, Amarok, TV Browser which uses an
70 incredible amount of RAM), some Dolphins, some Konsoles, a few Konquerors,
71 about 15-26 Chromium tabs, KMyMoney, some editors, sometimes Qt Creator, and
72 some Okulars. When I file some photos from my camera with Digikam, I
73 normally do not close it afterwards, hoping that it gets swapped out if
74 needed, and unless I start using it again this should not cost too much of
75 my RAM. This has always been my style of working, I don't like to close an
76 applications just after working with it. And it was fine in the past, with
77 much less memory, and with a virtual machine running all of the time.
78
79 Now I got another 2G of RAM, and things are better. But still, I have 800M
80 of swap right now, without using special applications or VMs. At this
81 moment, it's not problem, there is no paging going on. A little while ago,
82 it was quite noticeable. I was running rdiff-backup stuff at that moment,
83 but so I am doing now. Weird.
84 Oh, even weirder: The phone just rang, and five minutes later, swap has gone
85 to 860M. I was running rdiff-backup --list-increment-sizes, maybe this uses
86 much memory, and caches the stuff. Now the command has finished, and paging
87 has stopped. The rdiff-backup process itself does not use much memory.
88
89 BTW, does anyone else's kwin use 750M? That's pretty high, I think it used
90 to be more like 300M.
91
92 Wonko

Replies

Subject Author
Re: [gentoo-user] Swap performance Paul Hartman <paul.hartman+gentoo@×××××.com>
Re: [gentoo-user] Swap performance Alan McKinnon <alan.mckinnon@×××××.com>
Re: [gentoo-user] Swap performance Volker Armin Hemmann <volkerarmin@××××××××××.com>