In defense of swap: common misconceptions (2018)
A mini version of this was presented in the <i>wonderful</i> &amp; <i>amazing</i> &quot;Linux Memory Management At Scale&quot; video, also by Chris Down: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=cSJFLBJusVY&amp;t=11m42s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=cSJFLBJusVY&amp;t=11m42s</a><p>You should have swap. <i>You should have swap!!</i><p>This video is one of the most amazing, useful, gem-after-gem explanations of Linux you could possibly ever encounter. There are so so few who have the in depth knowledge, across so many broad experiences, at such scale, to understand Linux&#x27;s memory management.<p>Side topic #1: this video&#x27;s advice on cgroups just makes me sad, because I love Kubernetes, but Kubernetes building it&#x27;s own scheduler, in contest with not in tandem with the kernel&#x27;s cgroup system, is super super super f-ing sad. Kubernetes running all it&#x27;s shit in a single cgroup is some decrepit sad sad shit. I still love &amp; user Kubernetes, but god damn, for what basically amounts to a cloud os, it&#x27;s using the underlying host-OS extremely extremely poorly. This video was key in making me think &amp; consider how much we&#x27;ve lost, how sad it is we don&#x27;t take advantage of what the kernel is trying to do for us with trading off workloads. Leaving the kubernetes scheduler to try to fit all the workloads feels like we&#x27;re letting a bunch of ignorant elementary schoolers run the show. It&#x27;s embarrassingly superficial.<p>Side topic #2: it would be really interesting to try to go a bit deeper on the topic. I&#x27;d love a world where we can easily ask- what are these anonymous rarely used memory pages we get to swap out? That&#x27;s the main advantage, under low &amp; medium pressures: the system has some flexibility to move out things not really used, where-as it has to keep everything resident without swap. But answering: what are these things not being used: that probably requires bptrace foo to figure out what regions are getting swapped, plus deep skills to figure out what those addresses correspond to. I doubt Linux will just tell us, oh, I evicted this text block from the binary. (It likely doesn&#x27;t know much about what blocks it&#x27;s evicting.)