News for hackers. Stuff that matters.
Re:In defense of swap: common misconceptions (2018) by codeflo on Wednesday April 20, 2022 @10:29PM (#31105459)
> Try putting a consumer-grade SSD into a machine with 512 GiB RAM and let the kernel swap to it -- that SSD will be dead in a year.

Are you sure? I’ve heard the argument before that swap is one of the better cases for SSD longevity, because it’s few big writes instead of many tiny ones, and found that convincing. Also, on which workloads would a machine with that much RAM touch swap at all? My workstation has “only” 64 GiB, has swap configured (to enable suspend), even during heavy use with some databases running never touches it.

Re:In defense of swap: common misconceptions (2018) by marcosdumay on Wednesday April 20, 2022 @11:11PM (#31105680)
The alternative of the large writes swap does is not a lot of smaller writes, it's no write at all.

Also:

> on which workloads would a machine with that much RAM touch swap at all

On most of them? You seem to be using a flawed model of the Linux swapping algorithm. Writes aren't caused by lack of memory.

Re:In defense of swap: common misconceptions (2018) by codeflo on Thursday April 21, 2022 @12:31PM (#31111605)
I know you're not the GP, but please give some specific examples of such workloads, I honestly want to know.

To be clear, yes, it's well-known that the kernel will page out rarely used stuff, but those are (almost by definition) pages that are basically never written to. The claim was that writes to swap occur all the time, to the point where they wear out the SSD, that seems to be something different.

At least I've never seen anything like that with any of my (workstation) workloads, like large C++ builds, TensorFlow experiments, or running lots of virtual machines. And that was only with 64 GiB RAM, not even the 512 GiB that the post I replied to mentioned.

Re:In defense of swap: common misconceptions (2018) by marcosdumay on Friday April 22, 2022 @08:07PM (#31129843)
The kernel write the pages into swap long before it decides they are rarely used. Otherwise rewriting them would be way too slow to be of any use. Any normal use will fill some swap space, and if the memory pages keep getting dirty (and you have spare disk IO), your computer will keep writing them to swap.

How much RAM you have is not really relevant.