<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - MemoryPressureHandler doesn't work if cgroups aren't present in Linux"
href="https://bugs.webkit.org/show_bug.cgi?id=155255#c26">Comment # 26</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - MemoryPressureHandler doesn't work if cgroups aren't present in Linux"
href="https://bugs.webkit.org/show_bug.cgi?id=155255">bug 155255</a>
from <span class="vcard"><a class="email" href="mailto:tonikitoo@webkit.org" title="Antonio Gomes <tonikitoo@webkit.org>"> <span class="fn">Antonio Gomes</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=155255#c25">comment #25</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=273833&action=diff" name="attach_273833" title="Patch">attachment 273833</a> <a href="attachment.cgi?id=273833&action=edit" title="Patch">[details]</a></span>
> Patch
>
> I think this patch needs to address clopez's feedback:
>
> """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
> <<a href="https://github.com/systemd/systemd/blob/master/src/basic/util.c#L498">https://github.com/systemd/systemd/blob/master/src/basic/util.c#L498</a>> or
> the e2fsprogs one
> <<a href="http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/tree/e2fsck/unix.c#n284">http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/tree/e2fsck/unix.c#n284</a>>
> (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."""</span >
For the record, on ChromeOS, the kernel provides a file (available for reading if system is under low mem conditions):
// This is the file that will exist if low memory notification is available
// on the device. Whenever it becomes readable, it signals a low memory
// condition.
const char kLowMemFile[] = "/dev/chromeos-low-mem";
No parsing needed of its content, just verifying its presence is enough.
The check happens every 1s, and I believe it would not be as expensive as actually reading and parsing /proc/meminfo every 1s.
If Linux would have something like this by default, it would do it, as far as I can tell.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>