top | item 47160167

(no title)

pezezin | 4 days ago

Zero. My office workstation has 48 GB of RAM, my home computer has 64 (I went a bit overboard). I have very bad memories of swap thrashing and the computer becoming totally unresponsive until I forced a reset; if I manage to fill up so much RAM, I very much prefer the offending process to die instead of killing the whole computer.

discuss

order

quotemstr|4 days ago

It's funny how people think they're disabling swapping just because they don't have a swap file. Where do you think mmap()-ed file pages go? Your machine can still reclaim resident file-backed pages (either by discarding them if they're clear or writing them to their backing file if dirty) and reload them later. That's.... swap.

Instead of achieving responsiveness by disabling swap entirely (which is silly, because everyone has some very cold pages that don't deserve to be stuck in memory), people should mlockall essential processes, adjust the kernel's VM swap propensity, and so on.

Also, I wish we'd just do away with the separation between the anonymous-memory and file-backed memory subsystems entirely. The only special about MAP_ANONYMOUS should be that its backing file is the swap file.

kevin_thibedeau|4 days ago

mmap is not swap. It's using the same virtual memory mechanisms to load/dump pages to disk. The policy for when to read and write those pages is completely different.

retrac|4 days ago

The ghost of Multics walks yet the page tables awaiting recorporealization.

anyfoo|4 days ago

I'm not an expert, but aren't you just reducing the choice of what pages can be offloaded from RAM? Without swap space, only file-backed pages can be written out to reclaim RAM for other uses (including caching). With swap space, rarely used anonymous memory can be written out as well.

Swap space is not just for overcommitting memory (in fact, I suspect nowadays it rarely ever is), but also for improving performance by maximizing efficient usage of RAM.

With 48GB, you're probably fine, but run a few VMs or large programs, and you're backing your kernel into a corner in terms of making RAM available for efficient caching.

pezezin|3 days ago

The point is to have so much RAM that you don't need to offload anything.

nwallin|4 days ago

I have 64GB of RAM and 16GB of swap. Swap is small enough it can't get really out of hand.

I have memories from like 20 years ago that even when I had plenty of RAM, and plenty of it was free, I would get random OOM killer events relatively regularly. Adding just a tiny bit of swap made that stop happening.

I'm like 90% sure at this point it's just a stupid superstition I carry. But I'm not gonna stop doing it even though it is stupid.

rmunn|4 days ago

Same here, though I settled on 32GB of swap because I have a 4TB SSD (caught a good sale on a Samsung EVO SSD at Newegg). But whenever I run `top`, I constantly see:

    MiB Swap:  32768.0 total,  32768.0 free,      0.0 used.
I could safely get away with 4GB of swap, and see no difference.

kalleboo|3 days ago

Luckily we're not in the spinning HDDs thrashing a working set in and out of 128 MB of primary memory days anymore. We have laptops that ship with SSDs that read/write at 6 GB/s.

I was experimenting with some graphics algorithm and had a memory leak where it would leak the uncompressed 12 MP image with every iteration. I was browsing the web when waiting for it to process when I wondered why it was taking so long. That's when I noticed it was using 80+ GB of swap just holding onto all those dead frames. It finished and meanwhile it had no noticeable performance impact on whatever else I was doing.

rcxdude|2 days ago

I ran with a setup like this for a bit, but I experienced far worse thrashing (and far more sudden onset) than I did with swap enabled. You need to take some extra steps to get a quick and graceful failure on RAM exhaustion.

linsomniac|4 days ago

I did similar with my 32GB laptop, but it was fairly flaky for ~4 years and I just recently put 48GB of swap on and it's been so much better. It's using over 20GB of the swap. The are cases in Linux where running without swap results in situations very similar to swapping too much.

pezezin|3 days ago

What kind of workload do you run that consumes 20 GB of swap???