On 20/10/19 10:59, Mick wrote: > On Sunday, 20 October 2019 00:35:56 BST Wol's lists wrote: > >> The original swap algorithm NEEDED twice ram as swap. And when Linus >> ripped out all the "optimisation", the vanilla kernels only needed to >> touch swap, and if they didn't have twice ram they would crash. > > Was this also the time when the default swappiness was set at 60? > > >> At that point, the recommendation changed to "no swap is fine, twice or >> more is fine, just don't have swap less than twice ram". > > Are you sure of this? At least on current kernels (I'm currently on 4.19.72- > gentoo) the overcommit_accounting kernel mechanism using a heuristic over- > commit memory handling is set at 0, which refuses wilder over commits, but > allows more measured over commits to use swap space. >
> > From the above and without further experimentation I assume having a swap > slightly larger than my RAM is more than adequate for a desktop, including > hibernating on swap. > As per Richard Brown, the current recommendation seems to be even less than that ... "2GB is plenty". That's the SUSE default. > >> My personal rule is to take the motherboard's max ram, double it, and >> create a swap partition that size on every disk. So my current desktop >> system has 80GB of ram/swap - 4x4GB slots times 2 disk drives. And my >> new system has 4x8GB so that'll be 160GB!!! HOWEVER - Richard Brown of >> SUSE said that's dangerous - if somebody fork-bombs you it'll take a >> long time to fill that much swap and regaining control of your system >> could well be a big red switch job. >> > > Each to their own, but I tend to think this huge amount of swap is probably > excessive, unless you're running some scientific applications which require > big over commits for their calculations. > Well, I do all my emerges on tmpfs, so if things like LO, firefox et al need maybe 10GB, I need at least that available ... (that said, 16GB ram could probably do it without needing swap :-) But seeing as I try to fill up my mobo ram, my disks are mirrored, and I still try and stick to the "twice ram" rule, this setup means any upgrades/changes to the computer means I don't break that rule. If it's overkill, well disk is cheap (and I can always nick a swap partition and repurpose it temporarily if needs be :-) Cheers, Wol