Serious OOM problems with zram - installing Fedora 44 with zswap

I’m struggling with memory issues on my ThinkPad, which has 16GB of RAM. When the memory fills up, the system suddenly stops responding for a few minutes until OOM kicks in. All it takes is opening one more tab, and nothing works anymore. I can’t even switch to a TTY. I’ve never seen behavior like this in all my years in IT.

I read this article by a META kernel developer. He deals extensively with memory management and is therefore very knowledgeable. The article describes the cause of my problems well. As a block device, ZRAM isn’t well integrated with the Linux MM. It knows too little about the swapped-out pages and their priority. Additionally, systemd OOM doesn’t seem to work well (for me?).

For various reasons, I don’t want to upgrade my devices, but rather reinstall them. I’m currently familiarizing myself with Kickstart config and Ansible. In short: during the reinstallation, I want to replace zram with zswap.

Do you have any ideas on how I can customize the installation? Do I need to run a normal installation and then install zswap and disable zram? Or is there a more elegant solution?

I think that you will have to do a normal install then add zswap and disable zram.
Zram is automatically configured during the installation, and disabling is relatively simple.

This file is the controlling part for creation of zram and even tells you how to disable it. /usr/lib/systemd/zram-generator.conf

I doubt that will help. Zswap and xram are two ways to do the same thing.

There are articles on lwn.net that explain that neither is well integrated with linux mm and work is going on to address the issues.

Maybe zswap will help you, up until now zram has been shown to work well for desktop use.

Please report your find8ng from using zswap.

Thanks for pointing me to LWN.net. I keep forgetting about this page whenever I do my research. When I did a ‘site: search n lwn.net, I only found one recent article. However, it only discusses general improvements to swap management through an additional layer of abstraction.

According to Chris Down, the biggest advantage of zswap is that it knows the priority of memory pages. When the RAM cache fills up, cold pages are swapped out to disk first. When using zram with additional swap space, zram fills the RAM cache first. Once that’s full, everything is written to disk. So there are still many old, currently inactive pages in fast RAM, while currently used pages are moved to the slow disk storage. According to him, systemd OOM should actually work in time on Fedora to prevent the memory from filling up. That doesn’t work on my device (Thinkpad X13 Yoga G2, Intel 11Gen). I was once able to open a TTY in time and saw intense crypt processes eating up a lot of CPU. Unfortunately, I can’t give you any more details, as the system stopped responding afterward. The article also describes such issues with META and Cloudflare’s live servers.

I don’t have any logs, screenshots, or other details, since the system freezes so quickly. Therefore, I don’t have enough information for a meaningful bug report yet.

Since I can fully understand Chris Down’s explanation, I wanted to test zswap this time.

You can try journalctl and see what is in there. Pull up the command for last 50 lines, or last few minutes after you force shutsown and reboot.

I had I reckon this exact same problem on a Lenovo with Celeron and 4GB RAM. I coould not use Firefox and watch videos at the same time, or the system would freeze if I searched through the vid, or at random points. I put that down to the low RAM, I have upgraded to a new 8GB RAM machine, and it is all going well now. So there must also be something about your machine, with really a lot of RAM.

That was what I was thinking of. The article points out a number of issues with swap that design changes are needed to fix. Neither zram or zswap are issue free. You just hit a different limitation.

Hi,

you wil need new HW RAM memory or the cheaper, but very slow native swap - partition.

Excuse my, but do you know what is oom-killer ? = Out Of Memory Killer. This is for emergency situation = no free memory. Well, swap is really slower - compare with RAM, but better, than OS collapsion. You should use and will have to learn: man VMM = Virtual Memory Manager. This is the same for every OS…

I would really be interested in learning about your experiences with zswap if you do take the step of installing it and disabling zram. So I’m in the camp of encouraging you to go for it, and reporting back on how well it works for you. :joy:

I read the same blog post by Chris Down that you did, and your interpretation was similar to mine. He did include a pretty detailed explanation on his take on why the Fedora Project went the zram route instead. You might want to make sure you fully understand that perspective prior to making the switch, but, in any case, it didn’t seem that difficult to switch back should you choose to try it and it fails to accomplish what you’re aiming at.

Not even relevant to this topic and you misused the term VMM. VMM is the Virtual Machine Manager for a user who is using VMs (Virtual Machines) and is totally off topic for situations where the system has inadequate RAM.

Are you asking what by credentials are to talk about this topic?
Yes i know the oom killer and what virtual memory is, I’m considered an expert by my friends and co-workers.

If the oom killer keeps running your workload is too big for the RAM you have installed.
Do you have a lot of RAM expensive tabs open in the browser?

Swap will only get you a little more head room, which may be all you need.
But you will see likely see pauses as pages are swapped out.

Hi,

sorry for my mistake: it should be “Virtual Memory Management”. There is not space to explain it. It is really complicated problem, but you could use google or similar pages: “Virtual memory management is an operating system technique that extends physical RAM by using disk storage, enabling computers to run larger applications and multiple programs simultaneously by creating the illusion of a larger, contiguous memory space. It uses paging and address translation to Map virtual addresses to physical locations, optimizing resource allocation and isolating processes for improved performance and security.”

I don’t understand, why your browser need more than 16GB RAM. Too many open tabs or memory leak?

Hi,

I’m still waiting for your answer, nothink, no problem.

Barry A Scott: if you know it (VMM), I dont know why you ask it? Or it yor qestion provocation only?

Jeff V: are you serious? You could repair my about name of VMM. Why you did’n it?

VMM will still VMM…

bye

Are you trying to answer @smirgl questions or are you trying to query something from me?

Are you addressing me?

I haven’t decided yet. @barryascott made me think again. He wrote:

Since I’ve found very few reports of similar issues, it would be worth running a new test with zram. If I encounter the same problems again after a fresh install, we can rule out an issue with my current setup. Then, as a second step, I’d like to test zswap. If I use zswap right away, we won’t know if it was just a faulty configuration on my end.
It will take me some time before I can reinstall my main machine. First, I want to test the automated installation with my backup device.
But I’ll definitely report back here.

I have an older laptop that I keep updated. That machine has only 8G of memory, and I have had encounters with the OOM daemon while using zram on many occasions. Mostly when reviewing large pdf files containing large numbers of bitmapped image files. The machine would seem to freeze—for a not insignificant amount of time, and then my pdf reader would disappear and things would carry on. So not a crash, but not a short time commitment either. This is not the ideal failure mode for my use case. That is just my opinion, of course.

The zswap thing as described by Chris Down sounded to me like it has some potential there despite the uncertainty on how much it’ll slow things down.

I don’t have that machine at my current location, but the next time I do, I’m going to create some swap space and implement zswap. I’m not going to do a clean installation. I’ll return with some observations on what I learn.

We’re not discussing doing that.

What’s being contemplated is using zswap with swap instead of zram, along the lines of what was the topic by Chris Down in the link posted earlier by @smirgl .

Hi,

I’m using old chinese notebook X220 i3 Sandy Bridge with - it works very well - after 15 years (red dwarf..). Of course I’m using it only outside of flat - I’m smoker. It have only 4 GB of RAM memory - no problem for it, my PC is Ryzen with more memory and etc …

If you want solve the problem with VMM, you should dedicated part of HDD (SSD, NVME or similar) for swap, or “pagespace” = it is the same.

It could be hard, becouse HDD is probable divided (?) and you don’t have free space. You could use gparted or similar SW.

But, VMM or swap doesn’t solve your problem with RAM or VMM…(?)

Hmm, I remember that IBM AIX was not possible instaled without pagespace.

I’m from the old school, I don’t use zram or zswap, only classically swap/pagesize.

So, my apologize for my English - I’m not native English person and I probable do many errors…

Please do not respond to me ever again. It’ll be a complete waste of your time and energy.

sorryHi,

you could use swap/pagespace for include your VMM, but I’ don’t experience with zram or zswap. It is probable only compress it the same. I didn’t try it yet. Sorry, by the my opinion why? If swap doesn’t help, you should buy more RAM memory. What I could more? Sorry…