On Fri, Nov 05, 2021 at 06:22:16PM +0100, Jan Stary wrote: > On Oct 25 21:21:52, h...@stare.cz wrote: > > On Oct 24 12:45:33, h...@stare.cz wrote: > > > On Oct 24 11:26:40, s...@spacehopper.org wrote: > > > > > > Does the swap partition sd0b actually exist, > > > > > > or are you by any chance running these machines swapless? > > > > > > > > > > Indeed, I am running without swap. > > > > > > > > Ah yes AFAIK that is not really supported. > > > > > > Is that specific to arm*? Or some other platforms? > > > > > > I have been using this Thinkpad T400 (amd64, 8GB ram) for years > > > without having a swap partition, running chrome and everything. > > > > Ou of curiosity, I added 8GB of swap to this amd64 machine > > with 8GB of RAM, and it started using it while there are > > gigabytes of free memory, making e.g. chrome quite sluggish. > > I am still puzzled by this. > > It seems that on arm64 (the RPI3 and RPI4 at least) > one wants to have a swap partition (however small), > even if the machine has eniugh RAM (like th 8GB on RPI4), > because otherwise processes are getting killed.
I initially wondered if adding swap really completely mitigated the issue, or whether it simply became much more difficult to trigger. However after a lot of testing with different workloads, I've not been able to reproduce it with even a small swap partition that is never used. Also worth noting is that it depends on what the process is doing. I've run invocations of md5 -tt on all cores, loading the CPU 100% for several hours and not seen a crash. Yet a kernel compile fails within minutes. Presumably it's because the compiler is manipulating a large number of pointers, and quickly tries to make an invalid memory access. However, interestingly, the outputs from the md5 processes always seem correct, whereas I would expect them to be wrong occasionally if some kind of memory corruption is happening.. > On amd64, OTOH, one wants to _not_ have a swap partition, because > the system starts to use it, even if there is plenty of RAM > (like the 8GB on the Thinkpad T400), slowing things down. This is exactly our experience as well. However, this behaviour of using swap to free up physical ram even though there is physical ram unused is likely by design and with certain workloads may give better performance. For example, a large operation on a database generating temporary data in RAM that will not be used immediately might benefit from being swapped out in anticipation, so that a future memory allocation can be made from physical ram immediately without needing to swap out the other data first. Our experience for about 15 years now is that on amd64, (and previously on i386), is that as long as you have plenty of physical ram for the tasks in hand, running swapless is by far the best configuration.