I’ve very often come across a situation where my PC almost completely freezes, when I for example have 876 tabs opened in firefox and decide to compile something from the AUR. The only method to non-destructively resolve this situation is to switch to an alternate TTY, e.g. Ctrl+Alt+F4 and pkill firefox. That usually takes some time since even the shell is unresponsive and the first many attempts generate a 60s login timeout before I can enter the password.
Usually I decide to create a swapfile right after installation. But there is an even better solution, which I am confident could be a very welcomed default system component: systemd-swap
After discovering Cart Narcs on youtube I just watched my swap grow from 256 MB to 4 GB and shrink down again. I did not notice any hiccup on my system at all. Amazing!
What should be discussed, though, is the remark of the systemd-swap developers on their github repository, which states that users should migrate to zram-generator, also mentioned on the Arch-wiki page about Swap: https://github.com/Nefelim4ag/systemd-swap
What do you think? Should this stay a manual task that every user has to take and decide upon one of the many (partly not well-known) solutions?
Some do not want swap at all. There are also choices between a swap partition, swap file, zswap, zram, etc. I’m sure you’re perfectly capable of doing your own research. Consult the Arch Wiki, it’s all there.
If you still have questions after all that exhaustive research, you’re welcome to ask them.
Now that I think about it, the OOM killer seems to be disabled in Manjaro/GNOME. If that was enabled, having no swap could indeed be a valid choice.
Right now, as it is shipped, Manjaro just becomes unresponsive, similar to a freeze, when out of memory. Or could that be a specific problem of my PC?
I shouldn’t have described the freeze conditions so vividly. You can trivially reproduce it by just opening tabs in a browser of your choice.
Interesting. about:support says WebRender is my Compositor, the setting gfx:webrender:all is false, though. My addons:
Swappiness is at its default value of 60, vfs_cache_pressure at 100.
I didn’t know about tlp. It has an effective config file with 47 lines. Thank You for the hint @nam1962, that is good to know.
Tweaking the scaling governor from schedutil to ondemand and energy policy from balanced_performance to performance gave me a whooping 0,1% performance increase according to geekbench.
It doesn’t seem that auto-cpufreq is installed by default. I couldn’t find the binary on my system.
Thank you for all the tips. But at some point I stopped customizing my OS unless I run into problems.
Setting up any form of swap solved the problem of a stock Manjaro freezing when out of memory. This is a problem especially for newbies who don’t know about swap, and probably won’t know what to search for. That is what I wanted to discuss.
Trying to reproduce this on a VM, I found out that automatic partitioning has an option for swap. That is very satisfactory and basically fulfills my feature request:
I would propose changing the default to swapfile, though. Otherwise users might think “no swap” is the way most people do it.
On another note:
I could reproduce that the system “freezes up” instead of the OOM killer doing its job on both Manjaro and Ubuntu. This seems to be an upstream issue: Opening enough Youtube tabs on a fresh install will freeze your PC. When I went on and opened even more tabs, the GNOME session crashed and I was back at the login screen.
By the way, canonical doesn’t even give you any say or information in its installer. They decide that you want to use a swapfile in their predefined size. I had to disable it for the test.
3 FF instances,each with 30/40 tabs - TB with 23 mailboxes - shortwave + pulseeffects - Hamsket with WhatsApp, Skype, Tweetdeck, LinkedIn messaging, Trello, Slack, Telegram, Discord, Locals, Elements - Signal - Bauh
This on my 11 years old I3 Asus + the setting I suggested →
total utilisé libre partagé tamp/cache disponible
Mem: 11751 6973 905 1277 3873 3190
Partition d'échange: 511 359 152