Gentoo Archives: gentoo-user

From: Wols Lists <antlists@××××××××××××.uk>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Memory manager
Date: Sun, 20 Oct 2019 11:59:13
Message-Id: 5DAC4C07.4040205@youngman.org.uk
In Reply to: Re: [gentoo-user] Memory manager by Mick
1 On 20/10/19 10:59, Mick wrote:
2 > On Sunday, 20 October 2019 00:35:56 BST Wol's lists wrote:
3 >
4 >> The original swap algorithm NEEDED twice ram as swap. And when Linus
5 >> ripped out all the "optimisation", the vanilla kernels only needed to
6 >> touch swap, and if they didn't have twice ram they would crash.
7 >
8 > Was this also the time when the default swappiness was set at 60?
9 >
10 >
11 >> At that point, the recommendation changed to "no swap is fine, twice or
12 >> more is fine, just don't have swap less than twice ram".
13 >
14 > Are you sure of this? At least on current kernels (I'm currently on 4.19.72-
15 > gentoo) the overcommit_accounting kernel mechanism using a heuristic over-
16 > commit memory handling is set at 0, which refuses wilder over commits, but
17 > allows more measured over commits to use swap space.
18 >
19
20 >
21 > From the above and without further experimentation I assume having a swap
22 > slightly larger than my RAM is more than adequate for a desktop, including
23 > hibernating on swap.
24 >
25 As per Richard Brown, the current recommendation seems to be even less
26 than that ... "2GB is plenty". That's the SUSE default.
27
28 >
29 >> My personal rule is to take the motherboard's max ram, double it, and
30 >> create a swap partition that size on every disk. So my current desktop
31 >> system has 80GB of ram/swap - 4x4GB slots times 2 disk drives. And my
32 >> new system has 4x8GB so that'll be 160GB!!! HOWEVER - Richard Brown of
33 >> SUSE said that's dangerous - if somebody fork-bombs you it'll take a
34 >> long time to fill that much swap and regaining control of your system
35 >> could well be a big red switch job.
36 >>
37 >
38 > Each to their own, but I tend to think this huge amount of swap is probably
39 > excessive, unless you're running some scientific applications which require
40 > big over commits for their calculations.
41 >
42 Well, I do all my emerges on tmpfs, so if things like LO, firefox et al
43 need maybe 10GB, I need at least that available ... (that said, 16GB ram
44 could probably do it without needing swap :-)
45
46 But seeing as I try to fill up my mobo ram, my disks are mirrored, and I
47 still try and stick to the "twice ram" rule, this setup means any
48 upgrades/changes to the computer means I don't break that rule. If it's
49 overkill, well disk is cheap (and I can always nick a swap partition and
50 repurpose it temporarily if needs be :-)
51
52 Cheers,
53 Wol

Replies

Subject Author
Re: [gentoo-user] Memory manager Mick <michaelkintzios@×××××.com>