1 |
On Saturday, 19 October 2019 14:11:26 BST mad.scientist.at.large@××××××××.com |
2 |
wrote: |
3 |
> Do systems run different memory management when swap is on versus no swap? |
4 |
|
5 |
The answer to this question is an unqualified yes, although you do not define |
6 |
your meaning of "different memory management". The existence of swap space |
7 |
and the kernel's swappiness setting will change the way memory is dynamically |
8 |
allocated to processes at runtime and may affect the responsiveness of your |
9 |
system. |
10 |
|
11 |
However, you may not experience any difference by having swap on, if your |
12 |
swappinness setting is low and in addition you never run a high enough number |
13 |
of memory hungry processes to consume all available RAM. |
14 |
|
15 |
|
16 |
> I know that in the past it was recommended to have at least a small swap so |
17 |
> the system used a better memory manager. Wondering specifically if I |
18 |
> should set up a small ram drive for swap just to get better memory |
19 |
> management or if I should run swapless as this particular machine has a |
20 |
> slightly obscene amount of ram available so I shouldn't need a proper swap |
21 |
> partition unless it affects memory management. |
22 |
> |
23 |
> -- “The whole world is watching! The whole world is watching!” |
24 |
|
25 |
The handbook recommendation to set up a swap space (partition) is probably |
26 |
made as a low cost, safe configuration to have, which may even save your bacon |
27 |
one day. It is conceivable you could set portage to run a large enough number |
28 |
of jobs on a memory hungry compile, e.g. chromium, to end up with no memory |
29 |
left. In addition, if you tried to Suspend-to-RAM, at a point when all of |
30 |
your RAM is being used, you would soon discover you can't do it without any |
31 |
swap space made available. If you hibernate, then a swap space (file/ |
32 |
partition) will be used, which makes it reasonable to have a swap space set up |
33 |
for this purpose in advance. For a desktop, the relative low cost of disk |
34 |
space today suggests it is a good idea to set up some swap space, even if you |
35 |
hardly ever going to use it. |
36 |
|
37 |
With the arrival of SSDs the usage of swap was discouraged, because repeated |
38 |
read/writes tended to age prematurely the (early) SSDs. I still use spinning |
39 |
disks for swap, but I don't know what the prevailing wisdom/experience suggest |
40 |
these days. |
41 |
|
42 |
Have a look at this for generalities: |
43 |
|
44 |
https://wiki.gentoo.org/wiki/Knowledge_Base:Is_swap_space_really_necessary |
45 |
|
46 |
|
47 |
And this for an alternative, or complimentary solution: |
48 |
|
49 |
https://wiki.gentoo.org/wiki/Zram |
50 |
|
51 |
-- |
52 |
Regards, |
53 |
|
54 |
Mick |