KDE crashing on 2GB RAM, kernel doesn't handle OOM right

It's a bare metal FreeBSD 15 desktop with 2GB RAM and a dual core overclocked to 3.05GHz.
Running KDE and Firefox starts putting RAM under pressure, obviously. KDE starts flickering, taskbar disappearing/restarting, start menu not drawing correctly, flickering. Then KDE completely crashes to terminal oftentimes.

This is seen on both UFS and ZFS, although much worse on ZFS.

Setting vm.pageout_oom_seq to higher value than default (from 12 to 1200) actually improves things on UFS to the point of usability, it seems, but does not work much on ZFS. I also tried to lower ZFS ARC memory limit to 500MB or to 1500MB but seeing the same problems.

Interestingly, at the default vm.pageout_oom_seq of 12 swap is NOT used at all when problems happen. At a higher setting of 120 and 1200 swap does start get to be used, but swap is used to some small percent of maybe 10-12%, and the problems begin even when there's a lot of swap space available.

It seems the kernel is not handling OOM conditions properly. There's some major screwing up going on that can crash stuff. It's consistently reproducible on this older desktop - and the same setup works great on my 32GB RAM machine (that's usually not utilizing all of RAM for now). This is not reliable! There's gotta be a way to never kill any memory when there's a lot of unused swap space available or something.
 
The Supreme Being ("AI") has some interesting ideas about this, can I please run this by the experts?

KDE + Firefox creates a scenario where memory pressure spikes faster than the default paging daemon (pagedaemon) can react.

Is the solution to this to increase the pageout wakeup threshold so that the pagedaemon starts looking for pages to free when there's still a decent amount of free RAM left? And to increase minimum free RAM? Maybe KDE needs more free physical memory available when the KDE compositor asks for wired RAM for texture buffers? It seems that GPU is denied new allocations when we're running at, like, 30MB of free RAM available.

vm.v_free_min=50000?
vm.v_free_target=200000?
vm.v_free_reserved=100000?
 
Do you have to run KDE on a machine with 2 GB RAM?
I have to run anything on anything to know what the specific limits are. I'm worried I will run into problems when I run into memory pressure problems on 32GB of RAM and crash something. And I read some anecdotal evidence online already that something similar might happen on bigger RAM machines.

I ran Gnome with Linux on that machine without problems, so I am fleshing out what FreeBSD does/does not do to make it work.
 
Back
Top