Gentoo Archives: gentoo-user

From: Michael Mol <mikemol@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] dm-crypt + ext4 = where will the journal go?
Date: Tue, 04 Sep 2012 16:12:52
Message-Id: CA+czFiDfvuwCHZEODRddT5RRhBRGYRxf6A1op-ppWDvaTH=38g@mail.gmail.com
In Reply to: Re: [gentoo-user] dm-crypt + ext4 = where will the journal go? by Dale
1 On Tue, Sep 4, 2012 at 11:53 AM, Dale <rdalek1967@×××××.com> wrote:
2 > Alan McKinnon wrote:
3 >> On Tue, 04 Sep 2012 09:15:31 -0500
4 >> Dale <rdalek1967@×××××.com> wrote:
5 >>
6 >>> I think the new method for determining swap is to use what makes sense
7 >>> and not the old rule of 'twice the ram'.
8 >> Alan's new rule of swap is:
9 >>
10 >> If you ever use swap as swap at all, find out how your machine is
11 >> misconfigured. When my 16G is "not enough" anymore, something is badly
12 >> wrong and it isn't not enough RAM and I need swap to wiggle around
13 >> in :-)
14 >>
15 >> I think the 2 x RAM rule stopped being applicable when the average
16 >> machine got to more than 16M. Some old memes are like zombies - very
17 >> hard to kill.
18 >>
19 >> This laptop has a "swap" partition, but it's not for swap, it's for
20 >> hibernate. And I never use it, it takes longer to come out of hibernate
21 >> than to just boot up from cold! These days I just suspend.
22 >>
23 >> None of this changes the fact that the kernel still does get upset when
24 >> it has no swap at all (even just a little bit). But that doesn't mean
25 >> we should still be using it as full-blown swap.
26 >>
27 >>
28 >>
29 >
30 >
31 > Yup. I have swap but I have it set to where it won't use it unless it
32 > is REALLY bad. I have swappiness set to like 20 or something. It will
33 > fill up my ram with cache and such but it rarely uses more than a few
34 > hundred kilobytes of swap. When I see it using that, I usually kill
35 > swap and add it back. I just don't like a machine with 16Gbs of ram
36 > using swap at all. I have thought about setting it to 10. Maybe then
37 > it will leave it alone until it really hits the fan. ;-)
38
39 Set swappiness to 0. Swap will be used if and only if absolutely necessary.
40
41 Also, you're unlikely to notice a performance hit if the amount of
42 data in swap is only a few tens of megabytes; the seek-and-read rate
43 of even spinning platter disks should tend to cause that bit of
44 latency to get lost in the normal noise of library linkage, data file
45 loading, etc. (heck, it might even still be in the drive cache) The
46 performance hit is there, but probably not subjectively noticeable.
47
48 >
49 > That said, I did roll over one night and notice that the CPU was going
50 > ape. I got up and into my chair to notice it was using almost all the
51 > ram and was starting to use a bit of swap. I switched to a console, ran
52 > htop and noticed that some KDE process was using about ~15.5Gbs of ram.
53 > It was crazy to see. I couldn't get it to die with kill -15 so I did a
54 > kill -9. I guess it had to know I really wanted it dead. It has not
55 > happened since so no clue on why it did that. Heck, it ran the same
56 > version of KDE for a good while and still didn't do it. Cosmic rays
57 > from Mars I guess.
58 >
59 > I would recommend at least 500Mbs or so of swap regardless of ram tho.
60 > Some swap is a good idea. Just try not to use it since it is dog slow.
61
62 Indeed.
63
64 > If you are using hibernate/suspend thingys then that is different.
65 > Isn't that when it has to be at least as much swap as you have ram?
66
67 Yes.
68
69 --
70 :wq