Gentoo Archives: gentoo-user

From: Volker Armin Hemmann <volkerarmin@××××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Re: Disabling swap & mounting /tmp on tmpfs = new standard?
Date: Sun, 31 May 2009 04:27:04
Message-Id: 200905310626.59450.volkerarmin@googlemail.com
In Reply to: Re: [gentoo-user] Re: Disabling swap & mounting /tmp on tmpfs = new standard? by Grant
1 On Sonntag 31 Mai 2009, Grant wrote:
2 > >>>> I recently disabled swap and mounted /tmp on tmpfs for a netbook since
3 > >>>> the SSD is so slow, and now I'm wondering if that would be a wise move
4 > >>>> for all of my Gentoo systems. In what type of situation would it be a
5 > >>>> bad idea?
6 > >>>
7 > >>> Instead of disabling swap, just make it small (like 32MB or something;
8 > >>> whatever the smallest allowable partition size is). The kernel needs
9 > >>> swap to operate optimally, even if it's extremely small. Just make
10 > >>> sure it's there.
11 > >>
12 > >> Hmm, on this old box I noticed swap was using more than 135,000K earlier
13 > >> today as I was emerging xulrunner and ImageMagick. I think that the
14 > >> size of swap is relevant to the memory size that the box in question
15 > >> has. Not all machines have found their way to 2G RAM yet ... ;)
16 > >
17 > > Don't forget that you can set swapiness too. This is set in
18 > > /etc/sysctl.conf and for mine I have this:
19 > >
20 > > vm.swappiness = 30
21 > >
22 > > The lower the number, the less chance of it using swap. If it is set to
23 > > 90, it will use a lot of swap which is fine if you have little ram or a
24 > > really fast drive. If it is set to 30, then it will not use swap unless
25 > > it is basically out of ram.
26 > >
27 > > With the setting of 30, mine uses swap when compiling OOo or some other
28 > > large package or if I am opening a TON of pics. Otherwise, swap is at 0
29 > > or close to it even after being up a long time. I have 2Gbs here tho.
30 > > Your mileage may vary.
31 > >
32 > > Dale
33 >
34 > Thanks Dale. Should "vm.swappiness = 30" work well on all systems?
35 > My Gentoo systems have vastly different specs and duties so I love
36 > tweaks that always improve things. It sounds like /tmp on tmpfs is
37 > one of those.
38 >
39 > - Grant
40
41 you can set swappiness = 0 which works even better, because the kernel will
42 only swap if it really has too.