[Webkit-unassigned] [Bug 155255] MemoryPressureHandler doesn't work if cgroups aren't present in Linux

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 30 08:10:54 PDT 2016


Carlos Alberto Lopez Perez <clopez at igalia.com> changed:

           What    |Removed                     |Added
                 CC|                            |clopez at igalia.com

--- Comment #22 from Carlos Alberto Lopez Perez <clopez at igalia.com> ---
I think we need something like this, because WebKit don't drops caches if the memory pressure handler is not working, which causes that the memory usage continues to grow forever causing all sorts of problems.

The current implementation based on cgroups doesn't work on a "standard" GNU/Linux system, because memory cgroups don't work out of the box.

To enable memory cgroups you need to configure quite a few things, you even have to modify the kernel boot parameters (by setting at least cgroup_enable=memory on it). Also the interfaces /sys/fs/cgroup/memory/cgroup.event_control and /sys/fs/cgroup/memory/memory.pressure_level are not accessible by a normal user by default (only by root)

So I doubt our current implementation based on cgroups is actually working on any system other than those the admin took care of fine tuning this or on embedded devices running webkit as root.

So I think this patch is a good fallback for the rest of systems (mainly Desktops running a standard Linux distribution like ours).

Regarding the concerns about that the wakeups could affect the battery life I propose that we only enable this fallback memory pressure handler when the system is not running on battery.

We can reliably detect this by inspecting some values on /sys. For example, we can borrow either the systemd implementation to detect this <https://github.com/systemd/systemd/blob/master/src/basic/util.c#L498> or the e2fsprogs one <http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/tree/e2fsck/unix.c#n284> (yes, fsck avoids running automatically if it detects you are on battery)

And I don't think we should hide this feature behind an obscure environment variable than other than we developers and power users will know about, but make it run by default when the cgroup based memory pressure handler fails and when the system is not running on battery.

Note: is a shame that Linux (in 2016!) don't has a standard/reliable way to poll for low memory conditions.

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160330/b34f5ebf/attachment.html>

More information about the webkit-unassigned mailing list