Bug 184684 - [bmalloc][Linux] Implement isUnderMemoryPressure()
Summary: [bmalloc][Linux] Implement isUnderMemoryPressure()
Status: RESOLVED DUPLICATE of bug 195938
Alias: None
Product: WebKit
Classification: Unclassified
Component: bmalloc (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-17 00:22 PDT by Zan Dobersek
Modified: 2019-04-05 05:20 PDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2018-04-17 00:22:48 PDT
We're lacking an implementation of isUnderMemoryPressure() in bmalloc on Linux, which would help a lot with the scavenging process in memory-constrained systems. When found to be under memory pressure, the Scavenger thread makes an extra effort to free as much mapped memory as possible.
https://trac.webkit.org/browser/webkit/trunk/Source/bmalloc/bmalloc/AvailableMemory.h#L62

Calling back to bug #176089, one issue there was large memory consumption. While the fix in that bug helped a lot in that regard, always returning true in isUnderMemoryPressure() for testing purposes helps even further, keeping memory consumption of the WebProcess constantly well under 200MB, while otherwise it rises up to 300MB before it's finally scavenged down to a bit above 200MB.

There are other use cases that would benefit from correctly determining in bmalloc when the process is in a memory pressure situation. MSE requires multible MBs of data being constantly downloaded and fed into the media pipeline. This is reflected in memory consumption, where lack of scavenges causes that consumption to grow as the playback proceeds.


No clear idea how to implement this from my side. I suppose it could mimic memory pressure handler in WTF, but it might also depend on other things, e.g.whether GLib should be used in bmalloc.
Comment 1 Zan Dobersek 2019-04-05 05:20:23 PDT

*** This bug has been marked as a duplicate of bug 195938 ***