Chris Down
chrisdown.name · Personal blog · on HN since 2018
Chris Down is a Linux kernel engineer who writes about memory management, swap, cgroups, and debugging operating system behavior.
What HN saysCommenters cite his swap post as the reference on the topic, and also link his piece on the mysterious number 1195725856.
43HN people shared it
28linked it in comments
22stories submitted
1.3Kstory points
3 months agolast shared
2018people per year2026
Most-shared posts
- 1In defense of swap: common misconceptions (2018)27 people · 611 points · first shared 2018 · 165 comments on HN
- 2Debunking Zswap and Zram Myths6 people · 3 points · first shared 2026 · discussion on HN
- 3Preventing outages with pkill's new –require-handler flag3 people · 9 points · first shared 2025 · discussion on HN
- 4The curious case of stalled squashfs reads (2018)3 people · 6 points · first shared 2018 · discussion on HN
- 51195725856 and other mysterious numbers2 people · 512 points · first shared 2020 · 78 comments on HN
- 6Tmpfs inode corruption: introducing inode642 people · 162 points · first shared 2021 · 27 comments on HN
- 7Creating controllable D state (uninterruptible sleep) processes2 people · 6 points · first shared 2024 · discussion on HN
- 81195725856 other mysterious numbers2 people · first shared 2020
- 9Linux memory management at scale2 people · first shared 2023
What HN people wrote when they linked it
MrDrMcCoy · 2024-10-15
Fair points overall. I think KSM is still useful and worth the overhead for things like sprawling browser tabs and densely deployed microservices.
I disagree that swap is only (or even primarily) for situations where you're running out of memory, though. It is useful for reducing I/O contention and improving memory utilization by replacing underutilized pages with file cache when it makes sense to do so. See this for more details: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
NekkoDroid · 2024-06-04
I guess the best I can give you is this:
https://chrisdown.name/2018/01/02/in-defence-of-swap.html
znpy · 2021-03-14
I have some questions.
I started reading about systemd-oomd, then followed the link to its manpage (at https://www.man7.org/linux/man-pages/man8/systemd-oomd.8.html) then followed a link from there to this page: "In defence of swap: common misconceptions" at https://chrisdown.name/2018/01/02/in-defence-of-swap.html).
The first line of the tl;dr is: "Having swap is a reasonably important part of a well functioning system. Without it, sane memory management becomes harder to achieve."
Now, afaik linux as a kernel is pretty much designed to have swap memory and really not meant to be ran without it. Except disabling swap is required to run kubernetes, so much so that the kubelet will plain refuse to start if it detects swap memory enabled.
Why?
lloydde · 2020-01-13
The link above doesn’t work for me, but the following one does: https://chrisdown.name/2020/01/13/1195725856-other-mysterious-numbers.…
offlinemark · 2020-10-17
You're right, I probably should have said "some operating systems". I was generalizing based on my own education, which used Linux. I believe Windows does not do this either, but I'm not sure how many OS 101 classes teach Windows kernel :)
> The advantage is that you find out if you don't have enough memory when you make the system call to request it, not by having the program killed.
I wonder how much of an advantage this is. Memory availability is constantly in flux, and Linux at least, goes to great lengths to reclaim memory before invoking the OOM killer, which is a last resort. What if memory frees up immediately after the application gets the error return, but before the app touches it?
I'd trust the kernel more to manage this than applications themselves, because the kernel can make much better decisions on how to juggle things (evicting caches and whatnot). Plus, we all know how well we all test our error handling paths :)
> (It may be time for paging out to disk to go away. It's a huge performance hit. Mobile doesn't do it. And RAM is so cheap.)
In case anyone is interested in learning more, this is an excellent article discussing the nuances of paging to disk: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
Re: mobile, does Android disable paging file mappings to disk, which happens even if swap is disabled? (Swap only affects anonymous mappings).
mkesper · 2026-08-18
Better use zswap, as zram and swap together can lead to priority inversion. https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html (found via lwn.net)
moebrowne · 2026-07-20
> swap is used when you run out of ram
This is not correct. Swap is not a RAM overflow.
> Swap is not generally about getting emergency memory, it's about making memory reclamation egalitarian and efficient. In fact, using it as "emergency memory" is generally actively harmful.
https://chrisdown.name/2018/01/02/in-defence-of-swap.html
fuzzy2 · 2026-07-19
It's also not the optimal choice in most situations: https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html
man8alexd · 2026-07-06
You have a lot of unused anonymous memory that is better swapped out and used as a file cache. Specifically for Linux swap, see https://chrisdown.name/2018/01/02/in-defence-of-swap.html
mixmastamyk · 2026-05-30
zswap works well in my experience. Don't need both. Combined with systemd-oomd I haven't had a swapping or memory issue in many years. 16gb here with VMs and lots going on. This doc clears some things up:
https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html
cromka · 2026-05-29
>You have a buggy program.
As in memory leak? No.
> Zswap has been available for quite a while.
Zsawp is not Zram, which is a distant relative of the macOS on-the-fly compression I was talking about. Zram is buggy and still advised against regular use (https://www.reddit.com/r/AsahiLinux/comments/1i3mdrw/comment/m7plkkx, https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html)… Zsawp itself is enabled by default in Asahi.
Zram and Zsawp are mutually exclusive on Linux. On macOS, both concepts coexist – except macOS is able to compress individual memory pages (https://news.ycombinator.com/item?id=38300432) on the fly. Zram is a compressed RAM block device with a hard capacity limit.
There is really no comparison here at this point. macOS is vastly superior in that regard.
Kim_Bruning · 2026-04-19
There's also kernel zswap, right?
https://www.kernel.org/doc/html/latest/admin-guide/mm/zswap.html
Oh right, definitely. Chrisdown wrote an article comparing the two:
https://chrisdown.name/2026/03/24/zswap-vs-zram-when-to-use-what.html
Zswap is supposed to degrade more gracefully.
There's even some HN comments on it:
https://news.ycombinator.com/item?id=47500746
NoGravitas · 2026-02-05
Even if you have plenty of memory for your work load, there are useful performance reasons for having some swap. The TLDR section of this link covers the important bits.
https://chrisdown.name/2018/01/02/in-defence-of-swap.html
Relatively speaking, you do need a lot less swap than you did back in the day, but performance will suffer if you don't have some, and having too much doesn't cost you anything except storage.
SCdF · 2026-02-05
You should still use swap. It's not "2x RAM" as advice anymore, and hasn't been for years: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
tl;dr; give it 4-8GB and forget about it.
jibal · 2025-09-21
> Programs, which allocate large amounts of memory without strict necessity to do so, are just a consequence of swap existence. "Thanks" to swap they weren't properly tested in low-memory conditions and thus no necessary optimization were done.
Who told you this? It's not remotely true.
Here's an article about this subject that you might want to read:
https://chrisdown.name/2018/01/02/in-defence-of-swap.html
lholden · 2024-06-16
Most people think of swap as "emergency memory in case I run out of memory" and while it's true that it can get used in this way, it usually serves a much more critical purpose in your OS's ability to reason about and use memory.
For a good article on why this is true for Linux: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
I believe that most operating systems are going to make use of memory in a similar manner.
With that said, I'll turn off swap on devices that have unreliable storage. (Anything using an SD card)
voxadam · 2023-12-14
In defence of swap: common misconceptions[0]
[0] https://chrisdown.name/2018/01/02/in-defence-of-swap.html
5e92cb50239222b · 2023-06-12
It is useful, unless you have an absolute crapton of memory, several times what you actually need. The swap is trivial to encrypt if you're paranoid (the key doesn't need to be persisted and can be generated from /dev/urandom on each boot).
https://chrisdown.name/2019/07/18/linux-memory-management-at-scale.htm…
https://haydenjames.io/linux-performance-almost-always-add-swap-space/
https://wiki.archlinux.org/title/Dm-crypt/Swap_encryption
rwmj · 2023-02-05
No swap is another one. For everyone who believes you should turn off swap, please read: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
Edit to clarify: SwapPING bad, having swap space good.
ilovecaching · 2022-10-15
My coworker at Meta and kernel memory management expert Chris Down already wrote about why you need swap:
https://chrisdown.name/2018/01/02/in-defence-of-swap.html
bityard · 2022-10-15
Swap actually increases system performance for many common workloads: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
kzemek · 2021-06-30
Related article that popped up sometime ago on HN: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
yankcrime · 2020-11-16
Don't do this. Disabling swap is bad idea: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
rys · 2020-01-13
https://chrisdown.name/2020/01/13/1195725856-other-mysterious-numbers.…
That seems to be the URL now.
lclarkmichalek · 2019-08-08
Your system would grind to a halt anyway; swap is simply giving the kernel more options to deal with the issue. Without swap the kernel has no options when it cmes to unreclaimable pages.
Obligatory link: https://chrisdown.name/2018/01/02/in-defence-of-swap.html
LargoLasskhyfv · 2025-07-21
Depends on your usage patterns. On 8GB I gave it (ZRAM) between 512MB to 768MB RAM, and later on just using whatever values for the relevant sysctls AntiX was using(or their scripts created dynamically during setup/startup) at the time. It isn't just vm.swappiness, there are others, and they changed, or got removed, and replaced by others, over the years. And all of them sort of interwoven, influencing each other via what's happening in vm-subsystem. Can have bad feedback loops if you do it wrong, and be counterproductive. So you have to experiment, and measure with different settings, for what you're running.
Where measure can be anything from htop/atop over https://github.com/cdown/psi-notify , to https://github.com/noiseonwires/memory-pressure and so on.
To understand what these sysctls are about, how they are related to each other, and to ZRAM, I'd recommend reading, or at least skimming https://chrisdown.name/2018/01/02/in-defence-of-swap.html , https://chrisdown.name/2019/07/18/linux-memory-management-at-scale.htm… , https://linuxblog.io/linux-performance-almost-always-add-swap-space , https://linuxblog.io/linux-performance-almost-always-add-swap-part2-zr… , https://linuxblog.io/linux-performance-no-swap-space , https://linuxblog.io/running-out-of-ram-linux-add-zram , https://github.com/ValveSoftware/SteamOS/issues/899 , https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performa… , https://github.com/CachyOS/CachyOS-Settings/pull/19 ,…