Rich Freeman wrote: > On Sat, Feb 29, 2020 at 4:33 AM Wols Lists <antli...@youngman.org.uk> wrote: >> I just have a massive swap space, and /var/tmp/portage is a tmpfs. So >> everything gets a fast tmpfs build, and it spills into swap as required >> (hopefully almost never). >> > I can articulate a bunch of reasons that on paper say that this is the > best approach. > > In practice I've found that swap on linux is sub-optimal at best. I > only enable swap when I absolutely have to as a result. I'll reduce > -j to lower memory demand before adding swap usually. On more > RAM-constrained hosts I'll enable swap when building specific > packages, or try to avoid those packages entirely. > > Maybe something has changed in the last few years and swap is actually > useful, but I'm skeptical. I always tend to end up with GB of free > RAM and a churning hard drive when I enable it. On SSD I'm sure it > will perform better, but then I'm running through erase cycles > instead. > > Like I said, on paper adding swap should only make things better. > But, that is only true if the kernel makes the correct choices about > prioritizing swap vs cache use. Sure, I could set swappiness to zero > or whatever, but then that just turns swap into a NOOP best case and > it isn't like I have OOM issues, so why bother?. >
I have a large swap space on my rig. Like you tho, I hate when it is used because it renders my system almost unresponsive. Even switching from one desktop to another can take a minute or even longer. I think swappiness is set to 20 or some low number. I only use it because while slow, I can usually kill the offending process before things start crashing. I just start htop, highlight the offending process and kill it. Usually it is a web browser or something that doesn't get hurt to much from being killed. While swap can be a necessary evil, I hate when even 1MB is used. Runaway processes is one reason I expanded my memory to 32GBs. It gives me more wiggle room for portage to be on tmpfs. You are not alone in your experience with this. Dale :-) :-)