No announcement yet.

Yes, Linux Does Bad In Low RAM / Memory Pressure Situations On The Desktop

  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    This is one of the very few cases where Windows works better than Linux and has for decades. There's a lot Windows is shit at, but if there's one thing it handles surprisingly well, it's running out of memory.

    Originally posted by Saverios View Post
    Okay, I'll bite. What should happen when you have no more memory and no swap file and an application asks for more memory? Isn't it up to the application to handle memory unavailability gracefully?
    Crashing the high-load program is one option. The whole system is unresponsive so it's very unlikely you'll get to ever get to recover the data anyway. It's better to lose some data than to lose everything.

    Though, what I'd REALLY like to see is something that triggers SIGSTOP to a process whenever it:
    A. Is consuming the majority of the total used RAM.
    B. The total available RAM and SWAP has exceeded 95%.
    By doing this, it's a win-win: your system remains stable and usable, and you still get a chance to recover and/or SIGCONT the process. There could be a single file in the /etc folder that controls the behavior of this (so for example, maybe you want to increase the limit to 99%, or use SIGKILL instead of SIGSTOP, or ignore SWAP percentages).

    Any reason why this solution couldn't be done?


    • #12
      But, but, Windows is a resource hog and everyone should just switch to Ubuntu and breathe new life into their Pentium 1's laying around!


      • #13
        Originally posted by Danny3 View Post
        This seems to be similar to my experience with Kubuntu on a flash drive.
        Very slow, lots of stalls, almost unusable.
        But of course, the case is the opposite, lots of free memory (90 -95%), but KDE Plasma can't or doesn't want to use it.
        I dare say it isn't KDE, but the Ubuntu base. I have some old hardware, and the UI runs literally triple the responsiveness on KDE or Manjaro versus Kubuntu.

        Modern Ubuntu even has lag when in the console (as in no X) on an Atom system. I don't know what they are doing to make it that slow...


        • #14
          Originally posted by skeevy420 View Post

          It's exactly how I'd expect it to behave.

          A system with the memory all used up and no swap space available runs like don't say...
          The problem is that it doesn't work correctly. Having no swap, when running out of RAM the system TRASHES the hard drive with IO, with NO reason in what is obviously a bug.

          What should happen is:
          - swap, if enabled and available
          - call OOM immediately

          The disk trashing behaviour makes NO sense and I really wonder what is being read/written - there is NO swap enabled.


          • #15
            Originally posted by atomsymbol View Post

            This is interpreting serious unsolved operating system deficiencies as positive features of the operating system.
            I consider it user error and not a deficiency of the OS. The user pushing something too hard isn't necessarily a computer problem for that matter. No matter how many safe guards are in place, it doesn't help it if a user pushes something beyond its limits. In this case they removed a safe guard and pushed it beyond its limit.

            How is the kernel supposed to know if it needs to halt Plasma, Firefox, Mplayer, LibreOffice, KSP, Kate, Yakuake, makepkg or what to keep the system in a usable manner? All it can do is juggle stuff with what little resources it has available.

            IMHO, this is really a problem that should be solved by a daemon that a user can configure it to kill/halt/suspend-to-disk programs in a specific order because the kernel can't read my mind to know what I consider to be the more important task. It would also need a blacklist of things to not kill ever like the actual desktop environment.


            • #16
              Originally posted by latalante View Post
              Never but never disable swap. Without a swap, as you can clearly see the system is not faster. It is much, much slower.
              1. Always but always use a swap file in zRAM.
              echo 2G > /sys/block/zram0/disksize && mkswap --label zram0 /dev/zram0 && swapon --priority 100 /dev/zram0

              2. If you made this mistake and turned off swap, run resource-consuming programs with a memory limit.
              systemd-run --user -p MemoryLimit=3G google-chrome

              3. You can always press the emergency key combination alt-sysrq-f
              An open tab in chrome will end with "Aw Snap!"

              Linux works on billions of different devices, there is no one right solution how to behave in such extreme conditions, satisfying everyone.
              If you run out of RAM, the OOM killer should be called immediately. Right now there is a long period of disk trashing even if you have NO swap enabled.

              This is obviously a bug.

              And alt-sysrq-f is a lifesaver


              • #17
                Originally posted by anarki2 View Post
                But, but, Windows is a resource hog and everyone should just switch to Ubuntu and breathe new life into their Pentium 1's laying around!
                It actually did the job for me with my 4GB Gemini Lake notebook. Maybe not only for me, which wouldn't make it a surprise why this hasn't been tackled yet?

                Anyhow, egregious advice: Buy a better system if the old one is overburdened for your purposes, memory pressure always sucks.


                • #18
                  Originally posted by Saverios View Post
                  Isn't it up to the application to handle memory unavailability gracefully?
                  Mostly no, since the introduction of virtual memory it's been standard procedure to simply assume memory will allocate (outside of special situations). Best you can hope for is a friendly error message and a crash.

                  I am interested in what it's actually doing, without swap I would have just assumed it would be killed (that's what windows does).
                  Last edited by down1; 06 August 2019, 03:10 PM.


                  • #19
                    Originally posted by skeevy420 View Post
                    It's exactly how I'd expect it to behave.
                    You'd expect to not be able to close currently running applications? How would you expect to free up memory then?


                    • #20
                      Haven't used swap for the last 10 years and all my kernels during these years have had swap functionality disabled.
                      Usually my system never goes above 4G userspace RSS. My previous machines were limited to 4G. Never had an OOM-kill or a severe pressure stall.
                      Seems to me that my system does better without swap up until it crashes than swapping itself to bits up until it's unusable.

                      Most gobbling of RAM during these years has been done by the excessive bloat of addon-libs that keep piling up with every new install or major upgrade.
                      My desktop usage profile is simple and limited. Browse, mail, code, movies etc.
                      I build a new kernel and reboot every new minor release.. Usually every other month.