15
5
All GNU/Linux distributions I tested so far have the problem that whenever the ram gets filled and the system begins swapping, the whole desktop and graphical user interface becomes unresponsive as hell to an extent that sometimes I have to wait about 5-10 seconds after having moved the physical mouse until the mouse pointer is actually moving.
This is kind of an annoying behaviour, especially on systems with low ram.
Is there any way to give some applications/jobs, like the desktop environment etc., a higher priority to stay in ram than other applications, so that the application actually hogging all the memory gets swapped before the desktop environment etc.?
EDIT: I'm talking of the case when the entire RAM is used so it will always start swapping if it isn't disabled (I don't want processes to be killed randomly). I had this problem not only in low ram environments, but as well with 8GiB of ram on my desktop machine, partly due to many VMs partly because of memory leakage. ZRAM isn't a solution either as it's only delaying the problem. The only solution I can think of for this problem is some userspace utility or kernel API that allows to prevent certain jobs to be swapped at all or at least make it very unlikely. Does anybody know another solution or knows anything about such a tool or API in existence or being planned?
2nd EDIT: ulatencyd doesn't seem to work with newer versions of systemd, according to https://aur.archlinux.org/packages/ulatencyd-git/ and https://wiki.archlinux.org/index.php/Ulatencyd . This may be because systemd took over full control of cgroups from a userspace perspective if I understand it correctly.
Any updates on this,
ulatencyd
is no longer available, I have serious issues with the swap behaviour as well, especially when there is a memory-leaking program. – user3467349 – 2015-05-16T20:31:45.1403
cgroups, if you have the memory cgroup enabled, and swap accounting enabled (
– derobert – 2013-09-30T15:26:09.230cgroup_enable=memory swapaccount=1
on the kernel command line; note this has a minor performance cost). Example implementation: ulatencyd.@derobert Great this seems like it's exactly what I was looking for. I'll start experimenting with this as soon as I have time. – FSMaxB – 2013-09-30T15:32:31.873
Great, ulatencyd even has an AUR package, guess I'm lucky being Archlinux user. – FSMaxB – 2013-09-30T15:46:10.710
There's even a wiki article https://wiki.archlinux.org/index.php/Ulatencyd
– FSMaxB – 2013-09-30T15:51:30.443If I could up vote this Q's more I would! Is there really no direct way to tell the GUI and few key programs to stay in RAM so it stays responsive? I mean, whats the worse case scenario of giving linux users this option? The computer crashes? WHO HASN'T DONE THAT BEFORE? :) I mean sometimes, I accidentally start too many VMs because I couldn't add (RAM numbers) correctly and then it takes FOREVER to bring things back under control. Telling the GUI and maybe terminal to stay in RAM would fix that right?! Please, someone answer this! – Damon – 2013-10-03T05:38:30.267
About ulatencyd: I can't get it to work because the modified kernel won't boot. And by now I'm not 100% certain that it actually is what I was looking for. – FSMaxB – 2013-10-03T13:32:54.850
@nab In my question I'm also addressing zram! – FSMaxB – 2013-12-09T17:35:51.103
Since you haven't gotten any very good answers here, you might want to consider flagging the post for moderator attention and asking them to migrate it to [unix.se], you might have better luck there. – terdon – 2013-12-11T06:28:21.803