Gentoo Archives: gentoo-user

From: Kai Krakow <hurikhan77@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: /var/tmp on tmpfs
Date: Sat, 10 Feb 2018 19:02:52
Message-Id: 46s3le-2ni.ln1@hurikhan77.spdns.de
In Reply to: Re: [gentoo-user] /var/tmp on tmpfs by Rich Freeman
1 Am Thu, 08 Feb 2018 14:50:31 -0500 schrieb Rich Freeman:
2
3 > On Thu, Feb 8, 2018 at 2:17 PM, Dale <rdalek1967@×××××.com> wrote:
4 >> As someone else pointed out, if you start using swap, that generally
5 >> defeats the purpose of tmpfs.
6 >>
7 >>
8 > I'll just add one thing to this, which I've probably already said ages
9 > ago:
10 >
11 > In an ideal world swap would STILL be better than building on disk,
12 > because it gives the kernel fewer constraints around what gets written
13 > to disk.
14 >
15 > Anything written to disk MUST end up on the disk within the dirty
16 > writeback time limit. Anything written to tmpfs doesn't ever have to
17 > end up on disk, and if it is swapped the kernel need not do it in any
18 > particular timeframe. Also, the swapfile doesn't need the same kinds of
19 > integrity features as a filesystem, which probably lowers the cost of
20 > writes somewhat (if nothing else after a reboot there is no need to run
21 > tmpreaper on it).
22 >
23 > So, swapping SHOULD still be better than building on disk, because any
24 > object file that doesn't end up being swapped is a saved disk IO, and
25 > the stuff that does get swapped will hopefully get written at a more
26 > opportune time vs forcing the kernel to stop what is doing after 30s (by
27 > default) to make sure that something gets written no matter what (if it
28 > wasn't deleted before then).
29
30 I can only second this.
31
32 > That's all in an ideal world. In practice I've never found the kernel
33 > swapping algorithms to be the best in the world, and I've seen a lot of
34 > situations where it hurts. I run without a swapfile for this reason.
35 > It pains me to do it because I can think of a bunch of reasons why this
36 > shouldn't help, and yet for whatever reason it does.
37
38 I really prefer having inactive things being swapped out than discarding
39 cache from memory. But since kernel 4.9 this no longer works so well. I'm
40 still seeking the reason. But for that reason, building in tmpfs is no
41 longer such an appealing option as before.
42
43 Otherwise, I was quite happy with swap behavior, exactly for the reasons
44 you initially outlined.
45
46
47 --
48 Regards,
49 Kai
50
51 Replies to list-only preferred.