Linux Performs Poorly In Low RAM / Memory Pressure Situations On The Desktop (phoronix.com) 569
It's been a gripe for many running Linux on low RAM systems especially is that when the Linux desktop is under memory pressure the performance can be quite brutal with the system barely being responsive. The discussion over that behavior has been reignited this week. From a report: Developer Artem S Tashkinov took to the kernel mailing list over the weekend to express his frustration with the kernel's inability to handle low memory pressure in a graceful manner. If booting a system with just 4GB of RAM available, disabling SWAP to accelerate the impact/behavior, and launching a web browser and opening new web pages / tabs can in a matter of minutes bring the system down to its knees.
Artem elaborated on the kernel mailing list, "Once you hit a situation when opening a new tab requires more RAM than is currently available, the system will stall hard. You will barely be able to move the mouse pointer. Your disk LED will be flashing incessantly (I'm not entirely sure why). You will not be able to run new applications or close currently running ones. This little crisis may continue for minutes or even longer. I think that's not how the system should behave in this situation. I believe something must be done about that to avoid this stall."
Artem elaborated on the kernel mailing list, "Once you hit a situation when opening a new tab requires more RAM than is currently available, the system will stall hard. You will barely be able to move the mouse pointer. Your disk LED will be flashing incessantly (I'm not entirely sure why). You will not be able to run new applications or close currently running ones. This little crisis may continue for minutes or even longer. I think that's not how the system should behave in this situation. I believe something must be done about that to avoid this stall."
In 2019 (Score:5, Interesting)
Re: (Score:2)
I agree with that sentiment, especially all the bloat. But I'm not sure today's computers, at least laptops, really are faster than ever.
I recently met with a friend who had just gotten a new Dell XPS and we both installed Anylogic and tried out one of the sample simulations. We started running it at about the same time but on my 8 year old Lenovo T430 finished the run in about 2/3 the time as the new XPS.
Now of course there are plenty of differences... I'm running Linux, his had Windows 10. And it's pos
Did Linus call him a fuckwad? (Score:2)
Just curious.
Re: (Score:3)
No, the new, improved Linus called him a "Lovewad" :)
It's swapping (Score:2, Informative)
Comment removed (Score:5, Insightful)
Re:It's swapping (Score:4, Informative)
Generally when Linux slows to a crawl, the OS has a poor time distinguishing between different tasks running through the desktop which all need to communicate with the X11 library. Once one task goes rogue, its interaction with X means that other tasks performances are going to be shoddy. There are two good solutions. First, you can hit Ctrl+alt+f2 through f6 to get to a virtual terminal. Since it has no interaction with the X11 library, it's quite speedy once you are able to log in. A second solution is to SSH into the machine from another machine and the same speed and technical reasoning applies here as well.
Comment removed (Score:5, Interesting)
Re: (Score:3)
(And either way, it's a horrible solution. "Dude! There's a bug in the kernel that means it goes to shit when it runs out of memory!" "OMG, are you an idiot? Just connect your phone to the Wifi, run ConnectBot, connect to your laptop's IP address - YOU DO REMEMBER THE IP ADDRESS RIGHT? - and type "killall 'Web Content' ; killall 'firefox'", duh!")
It's friggin' embarrassing. I run a mainframe operating system on my primary desktop. An operating system that runs SAP instances and the national banks of G7 coun
Re:It's swapping (Score:5, Funny)
If you give up Chrome and Chromium, you give up Skype
Wow, when you say it like that, I'll give up Chrome even faster!
Comment removed (Score:5, Interesting)
Re:It's swapping (Score:5, Insightful)
sysrq then. Either blindly (can't switch to the console well with modern graphics drivers), or via serial ("^t b" with tio). This works well even when the machine is mostly dead.
Comment removed (Score:4, Interesting)
Re: (Score:3)
So set process limits before you run chrome (ulimit -a)...
This will prevent the chrome process from consuming more than a fixed amount of resources that you specify, it will probably crash if it tries and fails to exceed that limit but it won't bring down the whole system.
Re: (Score:2)
Alas, that works well only with vgacon -- both nouveau and amdgpu take a long time to switch consoles during a swappeathon. And it's worse on newer machines: on a 6 core box, it was a matter of like 20 seconds, on my current 64-way desktop I pretty much need to ssh or serial in. (Obviously assuming your load swaps on all threads.)
Re: (Score:3)
A second solution is to SSH into the machine from another machine and the same speed and technical reasoning applies here as well.
Got it. Keep a second computer around to be able to use it to fix your Linux desktop when it goes haywire.
Re: (Score:2)
A terminal is not an OS level function. And even if it were, the window containing the terminal (assuming GUI) is not.
The console - no GUI - should remain available but I haven't tried it in a while.
Re: (Score:3)
Re: (Score:2)
linux 'desktop' is a fucking pig, at this point!
I am one of those that runs a window mgr (fvwm1) and no desktop, no drag-drop, no trashcan icon, no gnome and no tens of procs just there to 'support' the stupid desktop paradigm.
go back to the old days and things are still pretty good. you can run linux well in 4gb of ram; for a long time, my system had only 2gb and things were still fine.
tl;dr: dump the desktop and go lean and mean
Re: (Score:3)
...you just can't *do* anything with it, because our email and music and movies and games and spreadsheets and whatnot are all browser-based now.
The "collection of slightly buggy device drivers" future is here, and it sucks.
Re: (Score:3)
Is it? ..."
"If booting a system with just 4GB of RAM available, disabling SWAP to accelerate the impact/behavior
Re:It's swapping (Score:4, Insightful)
That's why it gets orders of magnitude slower, and the disk starts going crazy. Solution, add more memory or do less in memory. There are all kinds of ways to reduce memory usage.
I kinda agree. I do my primary development on a 2GB RAM Linux VM, running WindowMaker (16 desktops) and various small apps (lots of terminals, a calculator now and then, PDF reader, word processor, etc).
Using the browser with 12 tabs (Mostly Jira, bitbucket and gmail) moves my RAM usage from +-600MB to 1.8GB (+ 300MB swap). If I instead start up IntelliJ or Eclipse (for those rare occasions when I do something in Java) I fill up the RAM and swap goes up to 1.5GB.
For most people, it's only the browser that uses memory uncontrollably. As an example, close your browser completely, then reopen with only a single tab that goes to slashdot - my experiment on this resulted in the browser using around 400MB of RAM with only slashdot open. Each time I refreshed the page after login, it used another50MB or so of RAM.
For around a few MB of actual non-advertisement content, the browser will grab a couple 100s of MB of RAM and never let it go again!. Honestly, I don't even blame the websites at this point - the browser should be able to cut off unwanted content at the knees... but of course, they don't.
For long-lived tabs that haven't been active for a significant time, the browser should flush that crap out to disk (they keep it all in RAM, images and apparently video too!).
For tabs that go over some threshold (calculated as a percentage of all tabs open, maybe) they should stop all network traffic (put a button saying "This site is sending 200MB, press to continue receiving this data").
For javascript, why is there a sandbox that cannot constrain the memory being used?
Why can't the browsers shut off the auto-fucking-playing ads? At least provide me with a button that makes *all* video content downloaded only on request.
If browsers made the toxic sites perform poorly so that the rest of the system is responsive, sites would very soon get the fucking message and change their ways. There are only two competing browsers on the desktop. If one of them enforced good behaviour from websites the other one will soon follow due to a loss of users.
Unfortunately, of the two competing browsers one is unashamedly produced as an ad delivery mechanism with actual content being an afterthought, while the other is busy self-fellating to a new programming language that won't improve things one bit anyway.
The world needs a new browser (well, a rendering engine, anyway). It will take Mozilla too long to collapse under their own gravity, and once they do there is no promise that from the ashes a slimmer browser will emerge.
Re:It's swapping (Score:5, Informative)
Did you even read the article?
Yep!
He explicitly says "disabling SWAP to accelerate the impact/behavior"
That does not do what you think it does. It doesn't actually disable swapping entirely. It stops the kernel putting general memory pages out to disk. However, if memory pages are already on disk, i.e. read only pages of code in executables, then it will boot them out of RAM and simply fetch them later from disk when it needs to.
Start at the top. Read all the sentences. Then reply.
It's OK not understanding something, the mailing list poster didn't understand either (see his comment about the disk light), but you shouldn't be rude about it especially when you're wrong.
Re: (Score:3, Insightful)
Jesus fucking christ. I guess we found the full stack developer. Listen just because you have 64GB of ram in your system, along with a 64GB swap file, so you can smoothly run your brilliant node.js UI, doesn't mean the rest of us don't care about system performance.
Re:It's swapping (Score:5, Insightful)
The same way, engineers testing crash scenarios don't hit the brake on their test cars befor crashing them into a wall, Artem S Tashkinov did not at first buffer the first memory problems by adding more RAM and swap space. He wanted to see the border case, all memory used up. And he wanted to see the actual performance results not to be convoluted with buffering times for unused RAM pages on a hard disk.
Re: (Score:3)
Re: (Score:2, Informative)
He doesn't explain why he's doing that though, then complaining about the "significant impact" as if everyone were disabling swap. Do you disable swap? Who disables swap on 4gb then goes loading hundreds of tabs?
What happens when you disable swap then pour a pepsi into your power supply, also Linus' fault?
He's doing that to easily trigger a memory pressure situation that otherwise can also happen if you have lots of RAM and swap.
Re:It's swapping (Score:5, Informative)
No, because that's not really the fault here. The disk activity is **not** swapping. It's discarding mapped pages of executables and libraries from the filesystem, and then loading them back in again. It turns out that when the system is continually throwing away, and then faulting back in, pages which are needed for programs to run and make forward progress, that the system wedges up hard. It's not locked up, but for all intents and purposes, it might as well be.
Re: (Score:2)
Just a guess, but not all swaps have to be writes. Could it perhaps be swapping in read-only pages from executable images? Not that I'd bet on it, since I think ELF images require relocation fixes on load and don't get simply mapped and copied directly to RAM.
One thing that could be done (which I doubt is) is swapping by compressing pages. This was done back in the old days of classic MacOS with "RAM Doubler". I think there was also a similar Windows utility which didn't work as well. But if this were bein
zram, 20 years after RAM Doubler (Score:3, Interesting)
One thing that could be done (which I doubt is) is swapping by compressing pages. This was done back in the old days of classic MacOS with "RAM Doubler"
A feature now called zram [wikipedia.org] was added to the the staging area of Linux sometime in 2010 or so. It joined mainline Linux in March 2014, two months after the 20th anniversary of RAM Doubler's release [tidbits.com].
Re: (Score:2)
Start at the top. Read all the sentences. Then reply.
No, it won't swap out writable pages. It will eject read only mapped pages from executables and fetch them when it needs later. That's exactly the same mechanism as swap. The disk light is flashing because it keeps re-reading running executable pages.
Re: (Score:3)
Yes, it can. Mapped text pages are locked to modification. You'll get ETXTBSY if you try to write to a mapped file binary (ELF executable or library). The kernel is at liberty to discard mapped pages and load them back in at its leisure. They are indeed "effectively constant" as the post you replied to said.
Not really (Score:2)
Try running Solaris under memory pressure and you can see what "running poorly" actually means. The fact of the matter is that memory pressure will always cost you a lot of performance and responsiveness, there is no way around that. The one thing that could actually be improved is making mouse and keyboard more real-time, but even that will not help much. Other than that, get more memory. And maybe avoid memory-hungry applications. Also, disabling swap? Seriously? Swap is what keeps the system alive under
Re: (Score:2)
I've found the cause and solution to this problem. (Score:2)
Increase the /proc/sys/vm/watermark_scale_factor from the default 10 to 500 (Others have reported working at 200, I tested with 100, and that wasn't enough, but 500 works great.)
The system will the be able to swap cleanly under memory pressure without the stalling.0
Re: (Score:2)
The system will the be able to swap cleanly under memory pressure without the stalling
They turned off swap in this test because they are looking to make balancing within the memory model.......make better guesses. Yes, you can thrash all day long, that's beside the point of these tests.
Re: (Score:2)
The LKML Post here: https://lkml.org/lkml/2019/8/4... [lkml.org]
It doesn't say anything about disabling swap.
I know well the problem that is being described here, and did much testing to find a solution that works well (with current kernels, not hacking the kernel code itsefl)
Am I getting old? (Score:5, Interesting)
'Just' 4GB of RAM
It wasn't that long ago that I had Xubuntu humming away on on a Pentium M withg 256 Megabytes.
Was it that long ago? When was 7.10 released?
Where does it all go?
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
I have one desktop that is an Raspberry Pi model B (the original) and it's pretty clear how performance will nosedive if you open more than 1 or maybe 2 browser tabs. It's actually kind of usable with just one tab though. Enough to do google searches and read forum replies to help solve problems in other areas. The other thing that kills the box is big compiles, especially for programs like Wireshark where some of the
4GB is plenty RAM for any distro linux Desktop (Score:2)
Re: (Score:2)
Was it that long ago? When was 7.10 released?
I think it was in 2009. Anyway, one laptop got in 2009 had 2GB RAM and Win7. Ran decently.Now, it can barely run a web browser, though old versions of Gimp, InkScape and Audacity run decently.
In recent years, I've been using it for on location sound recording, running a 2012 version of Audacity with an old Teac 4 channel, USB sound interface and an older Crown quad microphone pre-amp stuffed in an aluminum attache case. (The laptop fits in the lid of the case. To setup, take out the laptop, plug in power an
Re:Am I getting old? (Score:4, Informative)
>> Was it that long ago? When was 7.10 released?
> I think it was in 2009.
Seriously? You guys don't understand what Ubuntu versions mean? It is literally a date.
It hurts when I do this! (Score:2, Insightful)
Well, don't do that..
For Pete's sake, who disables the swap space? There is a REASON we have that area on disk, just like Windows has the page file on disk. It is there to temporally store memory pages that are not part of a process that's scheduled to run. So things like initialization code which ends up in your processes memory space can be swapped out to make room for more pages. This is true on Windows AND Linux.
By the way.. This isn't a Linux only problem. If you disabled the windows page file spa
Re:It hurts when I do this! (Score:5, Insightful)
> For Pete's sake, who disables the swap space
Do you even understand what swap is used for and why it was designed???
To SIMULATE more RAM then physically exists. If you have enough RAM you won't even be swapping in the FIRST place.
> I've never done it, but I'm just guessing
If you don't know what the fuck you are talking about then why are you giving advice???
My Win 7 dev/gaming box has 32GB RAM and has been running with no swap for 10 years. Why? Because:
1. I **don't** want Windows shortening the life of my mechanical drive or SSDs, and
2. I want the app to crash instantly if there isn't enough free memory instead of Windows swaps for 5 minutes while it figures out "Gee, there isn't enough of a worker set of memory -- let's constantly thrash while I evict and reload from/to disk/memory."
Just because YOU require swap doesn't imply everyone has the same use case.
> Add more memory,
And how exactly do you do that on embedded devices or where the RAM is physically soldered in??
Found the noob who thinks "Just throw more money/hardware at the problem has no other solutions.". **Facepalm**
Instead of treating the SYMPTOM how about addressing the issue of CAUSE of WHY you need to swap in the first place.
--
Adult Religion = Kindergarten Spirituality
e.g. One of the lies of Judaism, Christianity, and Islam: God commanded his children to murder one another.
Re: (Score:3)
That would be really buggy memory handling,
My experience both reviewing other peoples code and as an end user non-existent memory handling is the norm. Software which systematically checks all memory allocation is rare unless using a language which will always throw an exception as a result of consequence. From what I see reviewing other peoples code any error paths that exist are superficial, have never been tested and don't properly propagate consequences of failure.
The closest to your scenario you should get is malloc() returning NULL, and the program failing to check for NULL pointers.
You're right a program attempting to access null pointer will crash and this h
Re: (Score:3)
For Pete's sake, who disables the swap space?
Because they're testing the kernel's memory model. If the swap was on, then they'd have to get through a lot of thrashing which would start bringing disk IO into the picture. They're specifically trying to test the kernel's balancing model for active and inactive, which hasn't been the greatest. Long story short, they specifically did this to test something very specific in the kernel.
At least your Linux box stays running until the program soaking up all your RAM hit's malloc and get's nothing back and crashes the process (assuming somebody is actually *checking* that malloc was successful.. )
Legacy code I give a pass to and very, very specific exceptions as well, but no one should be using malloc anymore.
Re: (Score:3)
Always disable swap. Helps to detect if there's stuff running that should not be. Also saves wear and tear on both data and ssd storage.
Since the problem is pretty much down to web browsers and bloated desktop environments, getting rid of those two should mean never needing swap.
It would be good for cpu makers to put out chips that don't have the capability to use swap space as virtual ram. They'd probably be more energy efficient, and save a bit of die space, while allowing for faster overall performan
Re: (Score:2)
For Pete's sake, who disables the swap space?
It doesn't matter, because the problem exists even with swap on. The point in disabling swap in this case is simply to make it easier to replicate the scenario where memory pressure is high. You can encounter the exact same problem with 32GB of RAM and 2TB of swap space -- it just takes forever to load enough data to get the level of memory pressure needed to exemplify the problem.
Yaz
What performance curve do you want? (Score:2)
Do you want a system that's zippy until it's almost 100% resource-constrained, then it falls off a cliff and becomes barely usable or worse?
Or do you want one that's zippy until it's, say, 80% resource-constrained then it slowly gets worse and worse until it's barely-usable or worse when it's almost 100% resource-constrained?
That's actually a legitimate question with no one right answer: For some use cases, you WANT "give me all you got until you ain't got no more" and for others, you WANT graceful degrada
Application design issue. (Score:2)
The issue here isn't that the kernel starts swapping like mad to keep up with memory requests exceed the amount of system memory, the real issue is that you have an application that behaves badly. The application in question of course is no other than a browser which in recent years has morphed into a miniature operating system of it's own. The proper solution of course is to build pages on demand rather than trying to cache them all in RAM.
This is of course a complete non-story.
Re:Application design issue. (Score:5, Informative)
The application in question of course is no other than a browser
That's why the person decided to use that as part of their test. The issue is to test the kernel's ability to handle active/inactive page balancing and a good way to quickly get there is to get something that does exactly what you indicate a browser is doing. A web browser (Chrome/Firefox) was specifically selected to get the person there reasonably quick. It's not that they wanted to browse the web, that's besides the point. The point was to fill up the kernel's page listing as fast as possible and then see what the kernel would do in that situation, hence the reason for the boot string of memory at 4GB and swap off.
The kernel's memory management model isn't exactly the world's greatest and they're testing ways and methods to make it better. So any piece of software that would create loads of pages that the memory model would need to keep up with is a good piece of software to use to put some stress on the system. This is the LKML, not 1800-HELP-MY-KERNEL. In short, they're specifically selecting things to test something. Not moaning about how their web browser can't browse Facebook.
The proper solution of course is to build pages on demand rather than trying to cache them all in RAM
And if it did do that, then it wouldn't be very useful for them to use such a browser in this kind of testing, and thus they would have selected some other piece of software that would create a ton of pages of memory. The issue being discussed isn't browsers, why would kernel programmers care a flip about a browser?
Re: (Score:2)
Not quite, the article states that they disabled swap (for some reason)
The reason for disabling swap is to induce memory pressure.
The goal is to make the OS handle low memory situations more gracefully. Ideally it would remain responsive, allowing the user to kill unneeded programs to free up memory. That improvement would also apply to scenarios where swap was enabled.
How I work around this problem (Score:5, Interesting)
In
myself hard nproc 500
myself hard rss 1222000
Adjust to taste. This way a tab will crash and that's all.
But really, this should be fixed at system level, perhaps in the kernel. We shouldn't have to fiddle with settings. Ideally, nothing in user space should have the ability to render the entire system unresponsive. That's denial of service.
Re: (Score:2)
Nice try.
man limits.conf | grep -A2 rss
rss
maximum resident set size (KB) (Ignored in Linux 2.4.30 and
higher)
That was an example, bigger issue being discussed (Score:5, Informative)
I'm sure many will get on here and discuss the bloat of recent GUI toolkits in the Linux world. However, what Artem S Tashkinov is speaking about isn't, "Geez these toolkits are shit." This has been an issue with Linux for quite some time now. The issue is memory management and more specifically, active/inactive list balancing. There's an intro on the matter over at LWN here [lwn.net] that can sort of get you up to speed on the situation. It's from 2012, so things have been implemented to some extent and ideas have changed about how to truly "solve this" since then. So a good history lesson.
The whole 4GB and swap off is a setup to see how long it takes before the kernel doesn't know what the eff to do with the increasing number of pages that are active and inactive. Using the browser and GUI is a good and quick way to make the kernel go into stress. Obviously, if swap was on, then the kernel could just simply use that and thrashing would ensue. That would kind of defeat the entire test though. 4GB is there to ensure the list of active and inactive is good and long, something the kernel has had issues with.
The current idea for a solution is to use the kernel's PSI (Pressure Stall Information) model that is exposed via /proc/pressure and that information would be used by the Kernel to make better decisions. As well as give userland information that they could potentially use. There's already information in the kernel about refaults who Johannes Weiner, who has worked on this for some time now, speaks about here on the LKML. [lkml.org] However, PSI is currently optional within the kernel (defaults to N in the config) and the kernel itself doesn't contain the framework to make that data usable (that is the kernel can totally see that information but doesn't do anything with it in the memory management model).
Other vendors of Linux have written userland software that reads in /proc/pressure and does something useful with that information. Android has lmkd daemon. Facebook has an open source daemon called oomd [fb.com]. The idea would be to do something similar to these two examples but in kernel.
And with that, you are now caught up to what is actually being tested here in the kernel. You can keep doing your "GUI is bloated shit" conversations still, but at least now you all know what the actual topic is being discussed here.
Re: (Score:2)
Damnit. I logged in to upvote this and it's already maxed.
Use zram and shameless plug (Score:2)
Using this machine: https://bryanquigley.com/posts... [bryanquigley.com]
With zram enabled (it's the only "swap") and a full Gnome based Ubuntu desktop (Wayland) with Firefox (7 tabs) and Chrome (3 tabs) running .
Maybe just enable a small zram by default?
Re: (Score:2)
Interesting! It looks like if you insist on entirely disabling swap like in TFA, zram is the way to go. On the other hand, if you work in the real world and leave swap on, zswap [wikipedia.org] might be better.
Linux idiosyncronies (Score:2)
I've been more than happy to put up with any problems encountered using Linux. The price of M$ software is just too high.
Remember when 4GB was high end? (Score:2)
64GB? (Score:2)
Disk access generally stalls Linux (Score:2)
That's why I've learned to use ionice -c3 on every disk-intensive process where possible.
Year of the Linux Desktop (Score:5, Funny)
The Year of the Linux Desktop, actually happened in 2015.
The reason we didn't notice, is obvious now.
It's still buffering...
SysRq + F (Score:3)
Addressing a number of comments in this thread, as an emergency workaround, use SysRq + F. This invokes the OOM killer explicitly long before the kernel would have done it itself and is often preferable to doing a hard reboot.
Re:why (Score:5, Insightful)
It's not possible to upgrade every system, nor should that be a first-line solution to software inefficiency.
Re: (Score:2)
Re: why (Score:3, Insightful)
You are dumb. He did it that way because that is an easy way to reproduce the problem.
The problem is not that a 4gb Linux box chokes on chrome without vm. The problem is that Linux system performance does not gracefully degrade under memory pressure.
Instead of the n+1 task reducing performance by 1/ n+1, it reduces by (n+m )/n.
Basically it means the vm overpressure cascades through all processes and the scheduler for the cpu becomes a hostage to the memory pager.
Re:why (Score:5, Insightful)
People were saying "so what RAM is cheap now" back when motherboards could put 4GB max on.
Today we're saying "so what, RAM is cheap now" (when 32GB is £160 - hardly "cheap") and a mobo will take 64GB max.
will people in a few years be saying "so what RAM is cheap now" when someone is complaining that their 32GB RAM isn't enough to run Chrome with the latest "javascript compiled from c# running windows apps in a platform neutral web container"... probably.
Re:why (Score:5, Informative)
Re: (Score:3)
Re:why (Score:5, Interesting)
This is a test scenario.
I get this same problem with 32 GB of ram, Minecraft, Windows VM, Chrome, Firefox, and Thunderbird running.
I lose control of my desktop at this point and usually end up having to give it a solid 6 second power button restart.
I hate it and wish it would give me a chance to kill something to save the rest.
Re:why (Score:4, Interesting)
I hate it and wish it would give me a chance to kill something to save the rest.
This is really the problem and not the memory thing.
Under no circumstance should a desktop user not have control over his computer.
User interaction is a realtime task. It has precedence over everything.
It can be disputed that audio playback and to a lesser extent video playback should take priority to avoid stuttering, but user input is still a realtime task so failure to respond within 100 ms or so is unacceptable.
Want to be a usable desktop system? Never ever take away the users ability to control his computer.
Re:why (Score:5, Informative)
Likewise, I've suffered this same issue with systems with 8, 16 and now 32 GiB RAM. It's a problem no matter how much you have. On any of these systems, I can kill the system in 10 seconds just by running "make -j" or "ninja" while a VM is running (sometimes even without any VMs).
I consider this to be a serious flaw in the VM subsystem, which has been present and easy to trigger for many years now. It makes the system flaky and liable to lockup if you so much as look at it, and it really needs addressing properly, without hacky workarounds. It's not really swap related. I see memory still available for allocation as the stall hits (several hundreds of MiB), and many GiB swap.
Here is some discussion and investigation from a week or so back: https://www.reddit.com/r/linux... [reddit.com]
Re:why (Score:5, Informative)
Re: (Score:3)
Another problem is that many distros have magic sysrq disabled by default.
Re:why (Score:5, Interesting)
Go to an older distribution. They've larded distros with so much crap that it's stupid. Used to be I could run instances of MySQL and Postgres, Apache, sshd, all sorts of stuff, with swap disabled , GIMP, run a couple of different browsers, eclipse, etc., and barely consume 1 gig of ram.
A decade later, the DEs are all bloated unresponsive shit, same as the web browsers. Much slower on a quad core with 4x the memory and 4x the cores/8x the threads, at a 30% higher clock.
Shit software is shit software. Bloat costs. Featuritis is a disease. At this rate, it would probably be better to load a turn-of-the-century distro.
Re:why (Score:5, Insightful)
RAM is still a precious resource in many situations. If all you can think of is a desktop PC then maybe you haven't realized this. Linux is used in embedded devices, it's used in critical infrastructure PCs that can't be upgraded on a whim, and it's very common to revive older PCs that can't run Windows anymore. We even had a spike in RAM prices not long ago because of supply chain issues causing a shortage.
"RAM is cheap" is the mantra of bloatware developers.
Re: (Score:2)
Re: (Score:2)
Re: (Score:3, Interesting)
Windows, with the swap file enabled, actually uses some swap regardless of how much free RAM there is. 1GB, 10GB, doesn't matter, it loads about a gig of stuff into the swap file (last time I checked, which was on an earlier version of Win10). According to a Microsoftie who I questioned about this behavior when I was running Win7 RC on my gaming rig, this was to reduce the sudden change in performance when the RAM got close to full and swapping would actually become necessary.
I likened this to programming a
Re: (Score:3)
Yeah, well it'll be bollocks.
Windows uses the swap to store stuff, and if it has an aggresive memory swap algorithm (eg apps that are put to sleep are deliberately swapped away because nobody is going to use them, except rarely) then its not about reducing performance at all.
Re: (Score:2)
It is about performance or how the user will perceive the performance.
The apps that are active can allocate more RAM and be more responsive since they don't have to wait for the sleeping app to be swapped out. The user sees that as better performance.
Re: (Score:2)
Some other systems do this also. If some RAM has been idle for ages then it helps out performance overall if it can have the memory swapped out to make room for caching and ready use for active processes. Ie, start swapping stuff out before it's strictly necessary. Modern systems have a lot of fluff running at all times; in an older Unix system one would just kill off unnecessary processes, but there's so much more of this now. You can easily have 50 threads in a browser, almost all of which are idle. Out
Re:And Windows won't perform at all... (Score:4, Interesting)
this was to reduce the sudden change in performance when the RAM got close to full and swapping would actually become necessary.
This type of thing is how mainframe program demos used to do it. They would demo early copies of the program they were writing. But there were no users on the system, so the programmers would place "sleep" commands within the code. The user would get used to the screen response time so when real users appeared and the load increased to "normal" they would remove the sleeps so they would still see similar response times.
The alternative was a amazingly fast system in test with no users, then having them complain about slowness when it was in actual production.
Re: (Score:3, Insightful)
The entire goal of this is to improve user experience. If you have something in ram that has not been used in a long time you can COPY it to swap and then if you need to evict it due to memory pressure or due to the memory better being used for caching you can do it instantly. So during periods of low disk IO it makes sense to swap things out that are probably not needed. This spreads the IO load out and leads to a much smoother overall experience.
The alternative is to not swap until absolutely needed and t
Re:And Windows won't perform at all... (Score:5, Interesting)
I was surprised to find that OSX actually compresses RAM when it runs low, and does a decent job of it. I was running a memory heavy program that wanted a lot more than the 16GB that my Mac had, but it actually got nearly as far on the Mac than it did when I tried the same thing on a 32GB Linux machine. When the Linux box ran out of memory, it killed the program outright, whereas OSX tried to keep going, slower and slower while it was compressing unused memory.
ZRAM module works (Score:3, Informative)
I run Linux's ZRAM module. It's amazing for this purpose. It should be always enabled considering memory pressure is a real problem. The tiny CPU impact isn't.
Re:And Windows won't perform at all... (Score:4, Informative)
The CPU cycles to compress and decompress memory pages are orders of magnitude faster than paging to disk (even to a SSD). Memory compression is trading CPU cycles for IO stalls.
Re: (Score:2)
More than usable (and it applies to almost any linux distro in my experience...)
Re: (Score:2)
Re: (Score:3)
Feature creep, Agile, Scrum, and the "It builds, ship it!" mentality.
Re: (Score:2)
I remember running linux on 386sx systems with 4 MB of RAM.
What happened?
CI/CD happened. Or rather, CI/CD after the Pointy-Haired Bosses got hold of the thing.
Re: (Score:2)
Windows 10 works on 4GB of RAM decently for me... but it requires a SSD. I have found that the SSD makes all the difference in the world between something fairly usable, and something that just isn't worth bothering with. In reality, W10 needs 16 GB to be decently usable, but a SSD and 4GB can work.
Re: (Score:2)
On a laptop? Quite often that means binning your existing ram to buy a new stick - so "another" 4GB could easily be $40. Not *that* much, but not so "cheap" anyone can put it in their computers.
Particularly those running older ones that are likely to have low RAM in the firstt place, not everyone is a hugely remunerated tech worker with the latest hardware.
Re: (Score:2)
That's not a true statement, GNU/Linux has always been developed by corporates wanting something for their own use - IBM, RedHat, Canonical to name just 3 who are majority contributors.
Re: (Score:2)
At work, I have a Linux machine with XFCE that I use as my development PC. I also have a Windows 10 machine to run corporate apps, email and access the Internet. (The development PCs, whether Windows or Linux, are on an isolated LAN with no Internet access..)
At home, we have several desk and laptop PCs running Linux.
Re: (Score:3)
This is the most common issue I face when using a Linux desktop (P.S. we're mostly all aware of the mental models and technical functions of memory over here). Windows users rarely see this issue with the same severity;
Windows users don't see it because Windows won't run on a 4GB system with the pagefile disabled.
Re: (Score:3)