Hi
I don't have all the answers to your questions and it's even possible that what I'm going to comment is a bit outdated or plainly wrong, so please anyone else with more knowledge on this do correct me if needed.
In any case, here it goes anyway in case it can be of any help for your particular use case:
On 26/11/18 16:49,
ive...@noisolation.com wrote:
> [...]
> *Questions:*
> 1. Is there a concept of Memory Pressure for Linux? I cannot see it in the source. I assume this is supposed to hint to Chromiums allocators to ease off and GC when closing on the limit.
As far as I know there's still the old system based on the MemoryPressureMonitor class in place under //base/memory [1], which is still in use in some platforms but unfortunately not in Linux: just on Windows, Mac and ChromeOs.
Also as far as I remember, there have been attempts in the past to refactor this code into a |memory_pressure| component under //components/memory_pressure, including a Linux implementation (see [2]). However, and this is why you can't find anything in the sources, checking the commit history [3] I found out that this has been abandoned like 1.5 years ago in favour of the "memory coordinator work" (see [4]).
So, I think I'd suggest getting familiar with that "memory coordinator" work and figuring out the status of it for Linux, and whether you could work in that area to get your use case supported. Mind you, I'm not familiar with that so please take my word with a grain of salt, you'd better get in touch with the right people there and get advice from them if this is something you consider exploring.
> [...]
> 4. Any other ideas for me?
Alternative, you could follow another approach and do what Endless have done downstream to support their low-memory ARM devices a long time ago: hack your own version of the old MemoryPressureMonitor for your platform and adapt it to your needs. Endless did it based on ChromiumOS' implementation of MemoryPressureMonitor here, see the main commits here:
https://github.com/endlessm/chromium-browser/commit/6196cc79
https://github.com/endlessm/chromium-browser/commit/b6df3633
https://github.com/endlessm/chromium-browser/commit/146408fd
(you might find other interesting commits in the whole set of downstream patches in [5])
However, this came not without problems (e.g. heuristics not being entirely right, memory still filing up in some configurations...) so, based on my own experience and if it's feasible for you, I think I'd advise you to first check the status "memory coordinator" work first and see if that can fit your needs, before going the "downstream-only" route :-).
> I really appreciate any help or guidance you may provide me with!
As I said a couple of times already, take this mail with a grain of salt, but other than that I hope this is useful in some way.
Thanks,
Mario
[1]
https://cs.chromium.org/chromium/src/base/memory/memory_pressure_monitor.h
[2]
https://bugs.chromium.org/p/chromium/issues/detail?id=463606
[3]
https://chromium.googlesource.com/chromium/src/+log/master/components/memory_pressure/direct_memory_pressure_calculator_linux.cc
[4]
https://chromium.googlesource.com/chromium/src/+/4d1357d65728d99aef9de10f4ab8a914cb09b96d
[5]
https://github.com/endlessm/chromium-browser/commits/eos3.5