Memory pressure events not fired on Linux
Categories
(Core :: XPCOM, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox92 | --- | affected |
People
(Reporter: roc, Assigned: KrisWright)
References
Details
Currently memory-pressure events can be fired on Android and Windows, but never on desktop Linux as far as I can tell. Apart from the fact that they might be useful on Linux, this means there is no way to reproduce memory-pressure-related bugs on Linux under rr.
Is there any interest in adding memory-pressure detection for desktop Linux? If so, how should it work? It looks like a polling approach similar to Windows in xpcom/base/AvailableMemoryTracker.cpp should be possible by reading /proc/meminfo, but I'm not sure exactly when to trigger low-memory. Perhaps checking MemAvailable?
> MemAvailable %lu (since Linux 3.14)
> An estimate of how much memory is available for starting new applications, without swapping.
It's hard to say what the threshold should be ... wild guess, min(128MB, 1% of MemTotal)? Any non-zero threshold would let us fake /proc/meminfo results in rr to trigger memory pressure notifications.
Comment 1•6 years ago
|
||
Gabriele has been looking into memory pressure lately, and may have some opinions.
Comment 2•6 years ago
|
||
Yeah, memory-pressure events and memory tracking has never been implemented in Linux. The new polling method introduced in bug 1451005 could be used on Linux too but there's a few gotchas to take into account: opening/reading /proc/meminfo would be blocking so doing so on the main thread is not a good idea. I don't if it's possible to call an nsITimer callback on a background thread but if it is then it would be preferable (for Windows too obviously). Another issue is deciding what to measure and what would be the appropriate thresholds for sending memory-pressure events. Right now we don't have much data regarding Linux/Mac OOM crashes. It might be worth adding annotations like we have on Windows [1] and populate them with the information in /proc/meminfo. This should probably include swap information since it's not accounted for in MemAvailable. https://searchfox.org/mozilla-central/rev/b0275bc977ad7fda615ef34b822bba938f2b16fd/toolkit/crashreporter/nsExceptionHandler.cpp#733
Reporter | ||
Comment 3•6 years ago
|
||
> opening/reading /proc/meminfo would be blocking so doing so on the main thread is not a good idea
I suspect it's not really a problem. Reads from /proc are handled directly by the kernel and don't actually do any I/O.
Updated•5 years ago
|
Probably not correct connection. Should this bug (Bug 1475889) block Bug 1553260 or Bug 675539?
Comment 5•5 years ago
|
||
Good point, I mixed up the two bugs.
Updated•5 years ago
|
Comment 6•3 years ago
|
||
Kris, I'm assigning this bug to you because I've been told that you will help integrate Linux's memory pressure events with Firefox tab unloading. Thanks!
Comment 7•3 years ago
|
||
Tab unloading is a nice-to-have for our Fission Release experiment, but doesn't need to block it. I will move this bug from Fission Milestone M8 to MVP.
Comment 8•3 years ago
|
||
This bug is a soft blocker for Fission MVP. We'd like to fix it before our Release channel rollout, but we won't delay the rollout waiting for it.
Comment 9•3 years ago
|
||
Clearing Fission Milestone because firing memory pressure doesn't need to block shipping Fission MVP on Linux.
Comment 10•2 years ago
|
||
@Kris, OK to close this now that bug 1532955 has landed?
Assignee | ||
Comment 11•2 years ago
|
||
Yes, this work was finished as a part of bug 1532955. :)
Description
•